Komodo / KomodoEdit

Komodo Edit is a fast and free multi-language code editor. Written in JS, Python, C++ and based on the Mozilla platform.
http://www.komodoide.com/komodo-edit
Other
2.16k stars 302 forks source link

Display wrapping for comments at 80 columns instead of the right window border #3551

Open shelby3 opened 6 years ago

shelby3 commented 6 years ago

Per #541 Komodo Edit already has the feature to wrap the display of text at the right window border. This doesn’t actually modify the file just the display.

However, if I have my window maximized on a wide screen monitor so I can see the code unwrapped up to 200+ columns, the English text comments don’t read very well with that wrapping because humans lose track of where the next line begins when they have to scan so far from left-to-right when reading text. However this may not be the case with code, because code may have only every other or every few lines that actually extend out beyond say 80 columns. (Tangentially I am designing a programming language that will put the type declarations off the right-hand side for code)

Thus it would helpful if there was an optional feature to wrap only the comment lines at a set column when that column is to the left of the current right window border.

Some programmers manually wrap their comment lines, but I have found that for documentation at the start of a file and above each function definition, that I often need to write paragraphs, and I prefer to not manually wrap them, so that the reader can adjust the wrapping. Yet if I don’t manually wrap them, then when the right window boundary is at 200+ columns on my wide screen, then I can’t read the comments well.

Here is an example file:

/*
This file can be checked with shell command: ./slk -Ga -k=1 grammar

The lexer MUST:
   •  Not allow tab characters.

   •  Never issue the '<' token if it’s preceded by whitespace, because ' < ' is a distinct token for the “less than” operator to distinguish it from the use of the '<' token in other contexts in a context-free grammar.

      This resolves the LL(∞) ambiguity between the the “less than” operator and the `type-params` production. This is preferrable to wasting the '[' and ']' square bracket pair for type parameters. This also has the benefit of preventing the “less than” operator without whitespace, e.g. `1 < 2` is preferred instead of `1<2`.

      For consistency, never issue the '>' token if it’s preceded by whitespace, because ' > ' is a distinct token for the “greater than” operator to distinguish it from the use of the '>' token in other contexts in a context-free grammar. For further consistency, never issue the '<' token if it has trailing whitespace, so that formatting is consistent with the '>' token not allowing leading whitespace. However, do send the '>' token when it has trailing whitespace.

   •  Discard blank lines (including those with comments).

   •  Error if line contains only horizontal whitespace.

   •  Error if empty line (without a comment) follows INDENT or follows line(s) that contain only comments which follows INDENT.

   •  Issue INDENT and OUTDENT tokens only for columns at multiple of 3 spaces.

   •  Issue OUTDENT tokens for all in the INDENT stack for end-of-file.

   •  Issue one `\r` token after every consecutive set of OUTDENT token(s), before every INDENT token, and before every token that starts a line and is positioned at the column of the current INDENT stack.

   •  Error if the token that starts a line is before the column of the current INDENT stack.
*/

Note in your prior bug tracking system several years ago I had made numerous bug reports and suggestions which AFAIR were all deemed worthy of fixing or improving.

mitchell-as commented 6 years ago

Hi, thanks for the suggestion. Implementing this would require patches to the 3rd-party editing component that Komodo Edit uses.

shelby3 commented 6 years ago

Well my desire is to impact as many editors as possible. Would you like to mention the component project by name in case I or someone else decides to tackle it before y’all get around to it?[Edit: ah I see you added the component name to the issue. Thanks.]