New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
auto-justify body text #14
Comments
+1 for this feature. |
There are several ways Leo could insert newlines. After a specified column, or when the line would exceed the width of the body pane. On first thought, at a specified column seems more useful. Comments, please. |
Nearly all other text editors--if they offer this feature--use the specified column method, as far as I am aware. Normally it is described as wrap or rewrap, which comes into conflict with the I think terminology may be the biggest issue here. For clarity, when I refer to wrap/rewrap below I am describing the insertion of newlines, or removal and re-insertion to change the length of the lines. I think of justify as a purely visual (formatting) option (e.g. stretching character width so left and right appear to end at the same place) in the same general category as the existing Providing a rewrap-text command and using a specified number of columns to wrap seems to be much more flexible than only wrapping at the width of the body pane. The behavior is also consistent if the user switches between different screen resolutions that would affect maximum visible line length (e.g. laptop with external display). In other editors, the rewrap-text command generally does the following:
Obviously, the above doesn't exactly work well for code, but it is ideal for documentation or other prose. To work for code, it may only be necessary to change the definition of the paragraph break, but I'm not sure...I usually use language-aware code reformatting programs in that case, and they usually offer similar max-line-length options when appropriate. |
When @int autojustify > 0, Leo will insert a newline before the present word if it would exceed the given column number. Uses the auto indent feature to add indentation.
Rev 8ae11ae adds experimental support for auto indentation for programming. The only new code is in the newPlainChar method in leoEditCommands.py. Let me know what you think. When the new setting The code uses the auto indent feature to add indentation. Important: Leo's reformat-paragraph and unformat-paragraph commands use whatever I'll close this now. Please reopen if there are problems. |
I already don't like this feature. It would take AI to know how to split lines properly. For example, the user will want to insert comment delims when extending comments. |
My guess is the OP wanted this for prose, not code. I'd like it for prose too - my experiments weren't very successful when I tried it though (some time ago). It should certainly be possible. |
On Sun, Sep 25, 2016 at 7:44 AM, Terry Brown notifications@github.com
EKR |
Yes but that's intrusive, having to hit something at the end of every para., other than return, to type fixed width text, or letting the window wrapping handle it until you're done typing, then go back and reformat all the paras. |
To finish the discussion above, this actually works well for prose - I'd forgotten it was done already. So I think it's a valuable feature. It should probably get a toggle command though, so you can toggle it on and off, and I guess a setting to determine if it's on by default. |
Done in 05df9a |
Leo can wrap or not wrap body text, but this is just a visual rendering relative to the body editor window size. It would be nice if Leo could also automatically justify (insert newlines) in text as you type.
The text was updated successfully, but these errors were encountered: