Re: nano hangs when pasting just a few characters

Benno Schulenberg <[email protected]>
Newsgroups gmane.editors.nano.devel
Message-ID <[email protected]>
Op 24-02-2025 om 07:00 schreef Doug Smythies:
> Sequence of hex codes:  1b  5b  32  30  30  7e  31  30  30  30  30  1b  5b  32  30  31
> Sequence of hex codes:  7e

> Sequence of hex codes:  1b  5b  32  30  30  7e  23  64  65  66  69  6e  65  20  4d  41
> Sequence of hex codes:  58  5f  4a  50  53  20  31  30  30  30  30  1b  5b  32  30  31  7e

It seems that for your terminal, the first batch of a paste is
just 16 bytes, not 50 -- and that subsequent batches are larger.

Please try the attached quick patch.  When you experience a hang,
hitting ^C (or any other control combo) should stop the hang.


Benno
prevent-hang.patch (text/x-patch, 494 B)
diff --git a/src/nano.c b/src/nano.c
index b3f51e06..b47efa8f 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -1456,8 +1456,10 @@ void suck_up_input_and_paste_it(void)
 			line->data = nrealloc(line->data, index + 2);
 			line->data[index++] = (char)input;
 			line->data[index] = '\0';
-		} else if (input != BRACKETED_PASTE_MARKER)
-			beep();
+		} else if (input != BRACKETED_PASTE_MARKER) {
+			statusline(ALERT, "Bad terminal");
+			bracketed_paste = FALSE;
+		}
 	}
 
 	if (ISSET(VIEW_MODE))
OpenPGP_signature.asc (application/pgp-signature, 840 B)
-----BEGIN PGP SIGNATURE-----

wsF5BAABCAAjFiEEFo5vQpe/16ea/USWUUu+Lrjhlh8FAme8pL8FAwAAAAAACgkQUUu+Lrjhlh+2
Yg//XfByp+0y78oUPSNo09wiOVPqw/Csj8GIOkaoeBOGRYfdaKdH3RicmMD3f6ZzABqc6tdTkGG9
4aclKByKMWj2vASY4eId0Gw8cxu7rURV8WJbxlhJTA/VvTApZjIUbciCQfY6o/n+fWxdH8uSpXmi
Maa4PYrvM1xr6rkGcd/EimcxEPNfbuu0akwNOSlzCG6Xn/GO7jAuSzWG4/zX9Q/JurTKoWK+LXl5
wpAt9XPSZC5Kmv07QNyGX9zGrzvejIEZZwCqfxxu+hDBwdEV87tzcge9tonQ30z0ksKWJmGXREek
d/yWne51pjekVUdL20MN+JqAkEOCPNd5jj4iw6kURalS3CQWHoqIiMv+/AZf0gYN1XqQTRbghZpD
A/NDmlPi5Z4oHrYIyDSkl6aI7viVKwA/2lusvsOyqBYTilP4J8tSlNenqbYtD5fejSp3XZmLJ4rP
z6YU1nnwLWQSjPYAot8tO+WqaPfeFoOPcn1RtJhj5Yid73XzhL+asy5G9Qlo5Z53a1k4IieWh5Pr
Hn7wY10j6me4j7uSD6ZHKWXLtvksAaw3t/jDKMx+PE6pbe3wpMwcRAHLKPH6brx25wRqoI3VBD7d
bMCIURHrtw/h+uHX8UV2Xa0mWS5v3GXk3k/raB7ethSoRi/lK1QnJFHPLC9MfsLhVpPK7qzzgJ+d
npA=
=cDGO
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.