Rob said on Sun, 23 May 2021 12:50:15 -0700 (PDT) >Before I create an issue on GitHub, I thought I would ask here first >to see if the outcome is as intended or is a bug. > >I use the 'Extract' command frequently to create child nodes from >selected text (Edit->Edit Text->Create Sections->Extract). I find it >annoying that the command strips out all trailing blank lines. > >The same thing happens with a script I use to capture a node and its >children and copy to the clipboard (perhaps the code is related, I >don't know). The script begins: > >~~~ >s = g.getScript(c,p,useSentinels=False,forcePythonSentinels=False) >g.app.gui.replaceClipboardWith(s) >~~~ > >The result of both the Extract command and the script is the same; all >trailing blank lines are stripped out. > >Is this by design? If so, what is the rationale?
I lack the knowledge to speak for Leo, but in my travels I've found trailing whitespace to be nothing more than an invitation to bugs and problems. What meaning could possibly be assigned to trailing whitespace? What purpose could trailing whitespace have? Wouldn't there be a better way of signifying whatever is intended than trailing whitespace you can't visually detect? Note that Python's string strip() and rstrip() both remove trailing whitespace, including the newline. This gets the string in a known state, from which it can be processed, and then, if desired, the newline can be added back in. Apropos to nothing but a strong opinion I have, what's worse than trailing whitespace is the mixing of spaces and tabs. Because there's no visual way to tell the difference, and the games Vim and other editors play in converting between the two, mixing spaces and tabs is a horror movie just waiting to happen. SteveT Steve Litt Spring 2021 featured book: Troubleshooting Techniques of the Successful Technologist http://www.troubleshooters.com/techniques -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/20210523161826.74d23b4d%40mydesk.domain.cxm.
