RE: nano hangs when pasting just a few characters

"Doug Smythies" <[email protected]>
Newsgroups gmane.editors.nano.devel
Message-ID <[email protected]>
Hi Benno,

Thank you for replying to my email.

On 2025.02.25 08:16 Benno Schulenberg wrote:
> Op 24-02-2025 om 07:00 schreef Doug Smythies:
>> https://github.com/PowerShell/Win32-OpenSSH/discussions/2330
>
> Well, actually nano no longer hangs for you since version 8.0, but
> inserts a spurious tilde (~) after the paste.  Not nice, but... it
> doesn't hang.

Yes, agreed. 

> (You should have reported in your mail the exact version of nano
> you are using.)

Sorry that I was not clear.
My default nano version for my Ubuntu 24.04.1 server is 7.2
As a result of this investigation, I installed 8.3-1.
For ongoing work, and bisected cause and effect commits, I
cloned the git repository and compile it myself executing that
version via, and for example:
/home/doug/temp-git-nano/nano/src/nano bla.txt 2>TRAIL8 

> Please try the attached patch, to see if that helps avoiding the
> end-of-paste escape sequence from getting split.

Thank you for the patch. It made no difference.
I even tried a much bigger delay and several in between delays.

doug@s19:~/temp-git-nano/nano$ git diff
diff --git a/src/nano.c b/src/nano.c
index b3f51e06..6c9998ff 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -2483,8 +2483,9 @@ int main(int argc, char **argv)
        typeahead(-1);

 #ifdef HAVE_SET_ESCDELAY
-       /* Tell ncurses to pass the Esc key quickly. */
-       set_escdelay(50);
+       /* Tell ncurses to wait long for a sequence after an escape. */
+       fprintf(stderr, "HAVE_SET_ESCDELAY\n");
+       set_escdelay(9000);
 #endif

        /* Read the files mentioned on the command line into new buffers. */
diff --git a/src/winio.c b/src/winio.c
index 2fff0d9e..b4b8c49b 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -303,12 +303,10 @@ void read_keys_from(WINDOW *frame)
        /* Restore blocking-input mode. */
        nodelay(frame, FALSE);

-#ifdef DEBUG
        fprintf(stderr, "\nSequence of hex codes:");
        for (size_t i = 0; i < waiting_codes; i++)
                fprintf(stderr, " %3x", key_buffer[i]);
        fprintf(stderr, "\n");
-#endif
 }

 /* Return the number of key codes waiting in the keystroke buffer. */

And I still get the "~" and this, which is the same as my earlier email:

doug@s19:~/c$ cat TRAIL8
HAVE_SET_ESCDELAY
Sequence of hex codes: 102
Sequence of hex codes: 168
Sequence of hex codes: 104
Sequence of hex codes: 104
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:  18
Sequence of hex codes:  6e
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.