Leo now displays trailing whitespace.....

47 views
Skip to first unread message

Terry Brown

unread,
Jul 11, 2017, 10:07:42 AM7/11/17
to leo-editor
Leo now displays trailing whitespace.....

Although the (small ;-) consensus was to display this by default, I'm
not sure having it on by default is the best option - probably good for
coders, but maybe jarring for non-coders.

The reason people may not like it is because it displays trailing
whitespace immediately, including the transient trailing whitespace
that exists as you type a line containing spaces. Personally I don't
mind, it just expands the visual cue of the cursor position for me, but
some may find that annoying.

@bool color_trailing_whitespace = True

can be used to turn the feature on or off

@color trailing_whitespace_color = red

can be used to change the color of the marker

I'm fine with setting the default to False if even a couple of people
find this annoying - I think unlike a lot of code focused editors Leo's
focus is broader than coders only.

Cheers -Terry

Edward K. Ream

unread,
Jul 11, 2017, 11:09:45 AM7/11/17
to leo-editor
On Tue, Jul 11, 2017 at 9:07 AM, Terry Brown <terry...@gmail.com> wrote:
Leo now displays trailing whitespace.....

​I don't see this.

Edward

Terry Brown

unread,
Jul 11, 2017, 11:39:14 AM7/11/17
to leo-e...@googlegroups.com
Hmm, working for me, in the attached it's the grey dots, although in my
personal preferences they're red.

Leo 5.5, build 20170711100425, Tue Jul 11 10:04:25 CDT 2017
Git repo info: branch = master, commit = 08ca512da5f6
Python 2.7.12, PyQt version 5.5.1
linux2

Cheers -Terry
tw.png

vitalije

unread,
Jul 11, 2017, 1:03:28 PM7/11/17
to leo-editor
I can't see this on my computer. Should we change some setting to see the effect?

Terry Brown

unread,
Jul 11, 2017, 1:11:41 PM7/11/17
to leo-e...@googlegroups.com
On Tue, 11 Jul 2017 10:03:28 -0700 (PDT)
vitalije <vita...@gmail.com> wrote:

> On Tuesday, July 11, 2017 at 5:39:14 PM UTC+2, Terry Brown wrote:
> > On Tue, 11 Jul 2017 10:09:43 -0500
> > "Edward K. Ream" <edre...@gmail.com> wrote:
> >
> > > On Tue, Jul 11, 2017 at 9:07 AM, Terry Brown
> > > <terry...@gmail.com> wrote:
> > >
> > > > Leo now displays trailing whitespace.....
> > > >
> > >
> > > ​I don't see this.
> >
> > Hmm, working for me, in the attached it's the grey dots, although
> > in my personal preferences they're red.
> >
> > Leo 5.5, build 20170711100425, Tue Jul 11 10:04:25 CDT 2017
> > Git repo info: branch = master, commit = 08ca512da5f6
> > Python 2.7.12, PyQt version 5.5.1
> > linux2
>
> I can't see this on my computer. Should we change some setting to see
> the effect?

You could try setting
@color trailing_whitespace_color = red
or
@color trailing_whitespace_color = black

and see if it shows up then. I made the default mid-grey, #808080,
thinking that would be visible on dark and light themes and not too
intrusive. The screenshot I attached was from using the
HOME=/tmp python launch.... trick to get vanilla config.

Cheers -Terry

Chris George

unread,
Jul 11, 2017, 1:18:59 PM7/11/17
to leo-e...@googlegroups.com
Works for me.

Leo 5.5, build 20170711100425, Tue Jul 11 10:04:25 CDT 2017
Git repo info: branch = master, commit = 08ca512da5f6

Python 3.5.2, PyQt version 5.6.0
linux
isPython3: True
caching enabled


Chris



--
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 leo-editor+unsubscribe@googlegroups.com.
To post to this group, send email to leo-e...@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

vitalije

unread,
Jul 11, 2017, 1:27:54 PM7/11/17
to leo-editor

You could try setting
@color trailing_whitespace_color = red
or
@color trailing_whitespace_color = black


Yes, that solved the problem. Now I can see trailing white space. Though, I have noticed that it doesn't show trailing space in comment lines. 
Vitalije

Terry Brown

unread,
Jul 11, 2017, 1:49:26 PM7/11/17
to leo-e...@googlegroups.com
On Tue, 11 Jul 2017 10:27:54 -0700 (PDT)
vitalije <vita...@gmail.com> wrote:

> Yes, that solved the problem. Now I can see trailing white space.
> Though, I have noticed that it doesn't show trailing space in comment
> lines. 

ok, I'd missed that - I know it didn't show in multiline strings, but
not clear what the best choice is then anyway. It should definitely
show in comments, will see if I can fix that.

Cheers -Terry

vitalije

unread,
Jul 11, 2017, 1:59:18 PM7/11/17
to leo-editor
I know it didn't show in multiline strings, but
not clear what the best choice is then anyway. 

IMHO, showing them in multiline strings can't hurt. It is legitimate to have trailing space in those strings and sometimes it is intentional. In those cases it would be nice to have it explicitly shown. OTOH, if it is not intentional then user can see and fix that.

Vitalije 

Edward K. Ream

unread,
Jul 11, 2017, 2:42:51 PM7/11/17
to leo-editor
On Tue, Jul 11, 2017 at 12:11 PM, Terry Brown <terry...@gmail.com> wrote:

@color trailing_whitespace_color = black

​Works for me.  I like this feature.  Is there any way to make the dots larger, or change the background to make them show up more?  They are a bit hard on my eyes.

Edward

Terry Brown

unread,
Jul 11, 2017, 3:27:12 PM7/11/17
to leo-e...@googlegroups.com
On Tue, 11 Jul 2017 13:42:50 -0500
"Edward K. Ream" <edre...@gmail.com> wrote:

For me making them red makes then easy to see.

Otherwise the code uses **half** of your 'dots' hack for continued
strings. It uses the second half, applying dots if the tag name
starts with 'dots' (your original code) or is 'trailing_whitespace' (my
new code). It also acts as a regular colorizer "Leo rule", to get its
own color.

To fix the not shown in comments bug I think it needs to use the first
half of your dots hack as well, haven't got time to look at that right
now.

Finally, to make it easier to see, you could maybe change the style
from DotLine to SolidLine, not sure that can be done by stylesheet
though, probably needs a @setting.

Cheers -Terry

Edward K. Ream

unread,
Jul 12, 2017, 4:52:36 AM7/12/17
to leo-editor
On Tue, Jul 11, 2017 at 2:27 PM, Terry Brown <terry...@gmail.com> wrote:
On Tue, 11 Jul 2017 13:42:50 -0500

Finally, to make it easier to see, you could maybe change the style
from DotLine to SolidLine, not sure that can be done by stylesheet
though, probably needs a @setting.

​Thanks for all this work.  I'll probably just stick with the show-invisibles command​.  I can see the results of that command clearly, and I won't start obsessing about trailing whitespace ;-)

Edward

Josef

unread,
Jul 18, 2017, 12:37:58 PM7/18/17
to leo-editor


On Wednesday, 12 July 2017 10:52:36 UTC+2, Edward K. Ream wrote:

​Thanks for all this work.  I'll probably just stick with the show-invisibles command​.  I can see the results of that command clearly, and I won't start obsessing about trailing whitespace ;-)



The show-invisibles command does not show newlines, which means I am missing empty lines. Empty lines, especially when the last lines in a node are important when writing rST or LaTeX. 

- Josef
Reply all
Reply to author
Forward
0 new messages