Re: [PATCH] Allow 'set whitespacedisplay' in .nanorc
Peter Michaux <[email protected]> Thu, 24 Apr 2025 08:06:34 -0700
| Newsgroups | gmane.editors.nano.devel |
|---|---|
| Message-ID | <CAG0y48BNvws8P+R_t461j3GZ5+KF0AWmstRmvi0gnYz-1ud4XA@mail.gmail.com> |
Like Ivan, I have defined syntax for coloring whitespace by a light color so it is not intrusive. I would like to be able to set whitespace to be displayed in .nanorc so that it is always on when I start nano. Does making it possible to be turned on in .nanorc cause a problem? Peter On Thu, Apr 24, 2025 at 5:58 AM Ivan Vorontsov <[email protected]> wrote: > On Thu, Apr 24, 2025 at 10:20:05AM +0200, Benno Schulenberg wrote: > > > > Op 23-04-2025 om 20:47 schreef Peter Michaux: > > > This patch allows users to enable the display of visible whitespace > > > characters via their .nanorc configuration file by using 'set > > > whitespacedisplay'. > > > > But why? Who wants to see dots all the time for every file they open? > > I don't see the point. So, 'set whitespacedisplay' is not accepted, > > similar to why 'set view' is not accepted. > > > > > Previously, this option could only be activated while editing with M-P. > > > Making it accessible from the config file improves usability and > > > consistency with other display-related settings. > > > > As said above, I don't see any gain in usability. And there is no > > increase in consistency either, because consistent would be that > > there is also a command-line option to enable whitespace display. > > > > What _might_ be somewhat useful is to accept --whitespacedisplay > > on the command line (just like --view is accepted there), for the > > two or three people who always want to see dots. For consistency > > this would require also a short option. But I don't want to go > > there: we're running out of usable characters, and I would rather > > keep '#' and '=' in reserve. > > > > So... a possible compromise is attached. With that patch, one > > could alias nano to 'nano --white' and always see dots. > > > > > > Benno > > > diff --git a/src/nano.c b/src/nano.c > > index 39b93523..f61db14e 100644 > > --- a/src/nano.c > > +++ b/src/nano.c > > @@ -1832,6 +1832,7 @@ int main(int argc, char **argv) > > {"indicator", 0, NULL, 'q'}, > > {"unix", 0, NULL, 'u'}, > > {"afterends", 0, NULL, 'y'}, > > + {"whitespacedisplay", 0, NULL, 0xCC}, > > {"colonparsing", 0, NULL, '@'}, > > {"stateflags", 0, NULL, '%'}, > > {"minibar", 0, NULL, '_'}, > > @@ -2128,6 +2129,9 @@ int main(int argc, char **argv) > > break; > > #endif > > #ifndef NANO_TINY > > + case 0xCC: > > + SET(WHITESPACE_DISPLAY); > > + break; > > case '@': > > SET(COLON_PARSING); > > break; > > I would like to have an option and a command-line flag. All other feature > toggles have them (Syntax Coloring by defining syntaxes). It's convenient > to me for editing source files, because after exiting I have to toggle > Whitespace Display every time. > > I defined syntax for coloring dots by vague color (white is not white, > lightwhite is white :)), so they are visible but not stand out too much. > >