How can I disable auto-indentation in block comments?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 43
- Joined: Fri Aug 21, 2020 7:06 pm
How can I disable auto-indentation in block comments?
My stack has several objects with lengthy block comments (using /* and */) at the beginning of their scripts. These comments typically have semantic structure that is indicated by indentation (using spaces, not tab characters).
However, when I edit the code below such a comment, the editor frequently changes the block comment to have all lines flush left. This destroys the semantics, and thus the meaningfulness, of the comment.
How can I prevent the editor from doing this?
However, when I edit the code below such a comment, the editor frequently changes the block comment to have all lines flush left. This destroys the semantics, and thus the meaningfulness, of the comment.
How can I prevent the editor from doing this?
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: How can I disable auto-indentation in block comments?
If you could post a picture of what you mean
exactly it would be easier to understand.
exactly it would be easier to understand.
-
- Posts: 43
- Joined: Fri Aug 21, 2020 7:06 pm
Re: How can I disable auto-indentation in block comments?
Here is a simple example of such a comment. Some others have more levels of indentation.
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: How can I disable auto-indentation in block comments?
If that is a screen shot from the LiveCode scriptEditor there is something very odd about it.
In the LiveCode scriptEditor comment line starts with either '--', '#' or '//" depending on which of those you have chosen in LiveCode's preferences.
I can only see one of those in your screenshot.
- -
on closing this script and then reopening it the indentation is preserved.
I am obviously missing something
In the LiveCode scriptEditor comment line starts with either '--', '#' or '//" depending on which of those you have chosen in LiveCode's preferences.
I can only see one of those in your screenshot.
- -
on closing this script and then reopening it the indentation is preserved.
I am obviously missing something
-
- Posts: 43
- Joined: Fri Aug 21, 2020 7:06 pm
Re: How can I disable auto-indentation in block comments?
Okay, that is interesting.
I'm a LiveCode beginner, and I could not find the syntax for a block comment in the LiveCode Dictionary. A Google search found this Forums post, which contains this line:
You can put /* at the start of the section of code and */ at the end.
I did not notice that that post was from 2007. Apparently, things have changed.
That also might explain why in some of my scripts, the last few lines of a block comment (including the */) are rendered in the various colors as specified by the syntax coloring preferences, while the rest of the comment is rendered in green. It does not explain why the text from /* to */ is, in fact, treated as a comment by the LiveCode interpreter. All those scripts execute correctly.
In the current version of LiveCode, is there syntax for a block comment that does not require special character(s) on every line of the comment?
I'm a LiveCode beginner, and I could not find the syntax for a block comment in the LiveCode Dictionary. A Google search found this Forums post, which contains this line:
You can put /* at the start of the section of code and */ at the end.
I did not notice that that post was from 2007. Apparently, things have changed.
That also might explain why in some of my scripts, the last few lines of a block comment (including the */) are rendered in the various colors as specified by the syntax coloring preferences, while the rest of the comment is rendered in green. It does not explain why the text from /* to */ is, in fact, treated as a comment by the LiveCode interpreter. All those scripts execute correctly.
In the current version of LiveCode, is there syntax for a block comment that does not require special character(s) on every line of the comment?
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: How can I disable auto-indentation in block comments?
As far as I can tell, that is exactly the point of bog's picture.is there syntax for a block comment that does not require special character(s) on every line of the comment?
AND, NO that's not very helpful:
- -
However, on page 597 of the user guide, this IS:
- -
BUT, a right pain-in-the bum to find.
Last edited by richmond62 on Tue Feb 02, 2021 8:45 pm, edited 1 time in total.
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: How can I disable auto-indentation in block comments?
"I think Richmond might be a bit confused"
Well, possibly, but NOT about block comments for the very, very simple reason
that I had never come across them until about 10 minutes ago.
AND, who, one might ask, has read through the LiveCode guide as far as page 597?
https://livecode.com/docs/9-5-0/languag ... de-script/
- -
Although, as that refers to LiveCode 8.0 it is a bit out of date.
Well, possibly, but NOT about block comments for the very, very simple reason
that I had never come across them until about 10 minutes ago.

AND, who, one might ask, has read through the LiveCode guide as far as page 597?
https://livecode.com/docs/9-5-0/languag ... de-script/
- -
Although, as that refers to LiveCode 8.0 it is a bit out of date.
Re: How can I disable auto-indentation in block comments?
Well, ok, I won't bring up past threads you were in that mentioned them (since the mentioning was after your posts)richmond62 wrote: ↑Tue Feb 02, 2021 8:48 pmWell, possibly, but NOT about block comments for the very, very simple reason
that I had never come across them until about 10 minutes ago.


-
- Posts: 43
- Joined: Fri Aug 21, 2020 7:06 pm
Re: How can I disable auto-indentation in block comments?
Agreed. However, because we both posted simultaneously, I had not seen his response before posting my own.richmond62 wrote: ↑Tue Feb 02, 2021 8:36 pmAs far as I can tell, that is exactly the point of bog's picture.is there syntax for a block comment that does not require special character(s) on every line of the comment?
So, here's where I believe we stand.
1. The syntax /* comment */ is documented as one way to do multiline comments.
2. The LiveCode interpreter handles scripts with such comments correctly.
3. The LiveCode script editor does not handle such comments well when lines in the comment are indented with multiple space characters.
I have not yet been able to create a simple scenario that consistently displays this erroneous behavior. Until I can, I'll postpone submitting a bug report.
Re: How can I disable auto-indentation in block comments?
Hi.
Attached is the very first block comment I ever made. I always keep comments of all kinds to a minimum so I won't be able to understand what I wrote an hour ago.
But I find no issues with indentation, including after closing and reopening the stack, or quitting LC and starting a new session. However, if I cut the indented block and paste somewhere, indentation is lost.
Craig
Attached is the very first block comment I ever made. I always keep comments of all kinds to a minimum so I won't be able to understand what I wrote an hour ago.
But I find no issues with indentation, including after closing and reopening the stack, or quitting LC and starting a new session. However, if I cut the indented block and paste somewhere, indentation is lost.
Craig
Re: How can I disable auto-indentation in block comments?
Well, I hesitate to suggest this, but aside from what Craig said above, you can turn off 'auto formatting', and that *should* leave your comments alone. The problem is, it leaves ALL of the script alone, and formatting will then be up to you for everything.3. The LiveCode script editor does not handle such comments well when lines in the comment are indented with multiple space characters.


Re: How can I disable auto-indentation in block comments?
Block comments were introduced some time ago. I use them primarily for long explanations above handlers.
The tab key will format the handler where the insertion point is, and shift-tab will format the entire script. The only workaround I can think of is to format each handler independently and ignore the block comment. However, the script editor may have its own ideas when you next open the script.
You could submit a bug report, though it may be a low priority item in the general scheme of things.
The tab key will format the handler where the insertion point is, and shift-tab will format the entire script. The only workaround I can think of is to format each handler independently and ignore the block comment. However, the script editor may have its own ideas when you next open the script.
You could submit a bug report, though it may be a low priority item in the general scheme of things.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: How can I disable auto-indentation in block comments?
Comments are good but I don't use them enough. I had forgotten about block comments.
Here is a little stack that demonstrates how to pull comments from a script.
Only comments that start a line are shown, not comments that are at the end of lines or heavily indented.
The button puts the comments into a field and it puts them into a tool tip of the button.
Just having fun playing with LC,
Bob
Here is a little stack that demonstrates how to pull comments from a script.
Only comments that start a line are shown, not comments that are at the end of lines or heavily indented.
The button puts the comments into a field and it puts them into a tool tip of the button.
Just having fun playing with LC,
Bob