Re: getting nicely justified comments in an easy way

Benno Schulenberg <[email protected]> Sat, 30 Mar 2019 10:28:38 +0100
Newsgroups gmane.editors.nano.general
Message-ID <[email protected]>
Hello Seb,

Op 29-03-19 om 22:50 schreef Seb:
> Nice feature. Hopefully the upcoming new Debian stable will include a version 
> of nano compatible with it.

Sorry, no.  Debian was frozen before nano-4.0 was released, so the new Debian
stable will ship with 3.2.

> (I am French indeed but I use a qwerty keyboard, which I find more convenient 
> for typing code. Combinations with the Alt keys redefine the keyboard to 
> produce latin1 symbols. In nano, I use Esc, eg Esc-L for long lines. Esc-$ is 
> OK.)

You probably don't use the M-S toggle (to toggle smooth scrolling) so you
could do 'bind M-S softwrap main' and use Esc-S to toggle softwrapping,
which should be a bit easier to type.

(I am thinking about adding that binding to the default setup, because I
have machine where the Shift+Alt combos do nothing.)

> * Oh, I almost forgot, pico had a nice feature within Pine (before Alpine):
> if I put a "*" at the beginning of a line, then a space and then some text,
> the following line would automagically start with two spaces, as in this 
> paragraph. And it was compatible with ^J, too.

Hmmm...  A nice special case for a bulleted list.  But not for nano.

> Any chance of reproducing this clean appearance, or is it in the same
> category as introducing a '#' after a \n?

It would be much harder to make than an automatic "#".  See attached patch
for a quick and dirty implementation of the latter.  But... you can file
a feature request on Savannah if you want it and think the feature would
be useful to others too.

Benno

_______________________________________________
Help-nano mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-nano
0001-botch-recognize-and-as-whitespace-so-they-will-work-.patch (text/x-patch, 969 B)
From b45f8b5a8e64685a637aa38d28f83b961600d101 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <[email protected]>
Date: Sat, 30 Mar 2019 10:19:48 +0100
Subject: [PATCH] botch: recognize # and / as whitespace, so they will work
 with autoindent

When using --autoindent, pressing <Enter> at the end of a line that
starts with any combination of whitespace, #, and /, will precede
the next line with that same combination.  I don't know what side
effects this has, so use at your own risk.
---
 src/chars.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/chars.c b/src/chars.c
index 07620872..354cd9fd 100644
--- a/src/chars.c
+++ b/src/chars.c
@@ -97,6 +97,9 @@ bool is_alnum_mbchar(const char *c)
 /* This function is equivalent to isblank() for multibyte characters. */
 bool is_blank_mbchar(const char *c)
 {
+	if ((unsigned char)*c == '#' || (unsigned char)*c == '/' )
+		return TRUE;
+
 #ifdef ENABLE_UTF8
 	if (use_utf8) {
 		wchar_t wc;
-- 
2.20.1
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEv9AJBh5TUFKtDfIVDSjU0qCs6IQFAlyfNtcACgkQDSjU0qCs
6IRE7A//aYTDtS9t6+7Syx7/L3W084Ij9IleG8exMtMl8dUX/70d4kfNec5Dk6vU
VweucCCFwZ+yjCD06pTzgVSy0r3LWE4QUXVu54GyHrSegMSC0DHKcfUclpXdlJrC
LpmlbR5EEgT/S8nIW6sk8DtEkgvDHnP/sZuEBxXIt8Qk6YlSW1BuUGkAlpnlc+Sw
EGFRcWtcl1zktB425x6TXxwnkdWiCAsX+8tnx8xAG81OUqfB6m5tEpwPevcWYhfN
xt3fqUeYbFkjhq4k2z+SqxJrq/8pT8BEyiN+DIswr7XotNbQxgTThIR9nW325f7u
dOzN9B/DkBZAVhuQeQxqAfuYO8ul94flQKKFWuIy+b41WvK6aKcnng55txJe2sQ/
p82x/dqlBuL/xAFJyZhiQRMvi+nM91lojg/0+p7hzar+xI/szgOr2/IeKlgdW+Hq
PrNAu8IjgmM0pMfEcamWgeqarQuOjdfWB5pGii6EjX99tu9mQF+JMaOLSbjpPRHf
bnRyg8SanLeTyno4PdqtbsMa8YZt3HVkaXhb42msSUzpFIU9+2NXH3guxRGpGmMp
odwGgQ+ZIUVkwrwuxzxKaubtdOxrdV95bOS/aSqvUAk/EHYuBxHrDMcbUhDkhBT+
4tZrCn6MxRLJn3+qOTU2ACKuOqOvO2aaQnQmhj93K9DX4zKUd2E=
=NWgK
-----END PGP SIGNATURE-----