Re: [PATCH] Allow 'set whitespacedisplay' in .nanorc

Benno Schulenberg <[email protected]> Thu, 24 Apr 2025 10:20:05 +0200
Newsgroups gmane.editors.nano.devel
Message-ID <[email protected]>
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
see-blanks.patch (text/x-patch, 588 B)
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;
OpenPGP_signature.asc (application/pgp-signature, 840 B)
-----BEGIN PGP SIGNATURE-----

wsF5BAABCAAjFiEEFo5vQpe/16ea/USWUUu+Lrjhlh8FAmgJ9DUFAwAAAAAACgkQUUu+Lrjhlh9M
mA//ed5y8VLXu1qXx2x3Q/RSumWRX+iRusCXcKg0DHjYvPq2xyFfB/A2Ey75hD1jGyo+DOMDUXOI
jc99Ku4UwiDH5IvEHCTnNzjeo0S3RcgKEvHyWzgSeSVf5p54p7g2P1QBuWo1Xv+aFvk9X8A+hCTx
0hTC0DBs/TOLQviAubqWylN6SyqWUwb2sjhVTrHVcQmv3XdacMS4+FjZK6+DaI9tr00bj1OSmRFW
/55dghDlD0lf12ZlSKf7xRRb/ywdcxunuqGY5Hkma2jj7fe4HWqda6M1GL1c7gCv/4ETNg0F+3iK
GImPJrEXDwu0qsWKknC9LMyyx9mY1iwBVV4el+ZZ0BDaGCB2MfV2k0H7yynoKS+af3iQmqdqcRsS
fNCFQJlcUxGtkPk51saph/cl09QJZ90jos+LxL6iJQuMY9AXwGbj/kz2lf9NmgdzZEsjA5vvcXTs
q66cc/J/NoXGce3JkezN67IVqyx+TR7W2XOICI/oyvNeDXrmHX4tOcpmJZUrj0fr0Ek4XwzQGt1j
EimmPGp2v6M+UbnM2t4Iv9iq7UNff/XImSHZ+G/G7ga95WQqYBySjZptTT7Qv0NN4VL5MKwLHw3X
gGpC74bZeJd585JDNpSzqulgi6av1F+sjmokvHitgoCbpi5xkSKYPiVNNqMSGguJ4yi7N0Y5YDzN
Ax4=
=Hpak
-----END PGP SIGNATURE-----