RE: nano hangs when pasting just a few characters
"Doug Smythies" <[email protected]>
| Newsgroups | gmane.editors.nano.devel |
|---|---|
| Message-ID | <[email protected]> |
On 2025.02.25 15:32 Doug Smythies wrote: > 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. I did some reading, and now know that the passed variable to set_escdelay is in milliseconds, so 1200 is lots and lots of time. > > 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 I found some other paste buffer sizes that FAIL, in addition to the 5 characters already talked about. 85, 197, and 293 (there will be more, but that is as far as I got). If I use PuTTY instead of OpenSSH_for_Windows these buffer lengths work fine, suggesting that the root issue is with the OpenSSH_for_Windows code. The related debug captures from nano: 85 characters, OpenSSH_for_Windows: doug@s19:~/c$ cat TRAIL285 HAVE_SET_ESCDELAY Sequence of hex codes: 102 Sequence of hex codes: 1b 5b 32 30 30 7e 31 32 33 34 35 36 37 38 39 30 Sequence of hex codes: 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 1b 5b 32 30 31 Sequence of hex codes: 7e Sequence of hex codes: 18 Sequence of hex codes: 6e 85 characters, PuTTY: doug@s19:~/c$ cat TRAIL-putty-085 HAVE_SET_ESCDELAY : set to: 9000 Sequence of hex codes: 102 Sequence of hex codes: 102 Sequence of hex codes: 1b 5b 32 30 30 7e 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 1b 5b 32 30 31 7e Sequence of hex codes: 18 Sequence of hex codes: e 197 characters, OpenSSH_for_Windows: doug@s19:~/c$ cat TRAIL397 HAVE_SET_ESCDELAY Sequence of hex codes: 102 Sequence of hex codes: 102 Sequence of hex codes: 1b 5b 32 30 30 7e 31 32 33 34 35 36 37 38 39 30 Sequence of hex codes: 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 Sequence of hex codes: 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 Sequence of hex codes: 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 Sequence of hex codes: 37 38 39 30 31 32 33 34 35 36 37 1b 5b 32 30 31 Sequence of hex codes: 7e Sequence of hex codes: 18 Sequence of hex codes: 6e 197 characters, PuTTY: doug@s19:~/c$ cat TRAIL-putty-197 HAVE_SET_ESCDELAY : set to: 9000 Sequence of hex codes: 102 Sequence of hex codes: 102 Sequence of hex codes: 1b 5b 32 30 30 7e 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 1b 5b 32 30 31 7e Sequence of hex codes: 18 Sequence of hex codes: e 293 characters, OpenSSH_for_Windows: doug@s19:~/c$ cat TRAIL2-293 HAVE_SET_ESCDELAY Sequence of hex codes: 102 Sequence of hex codes: 102 Sequence of hex codes: 1b 5b 32 30 30 7e 31 32 33 34 35 36 37 38 39 30 Sequence of hex codes: 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 Sequence of hex codes: 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 Sequence of hex codes: 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 Sequence of hex codes: 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 1b 5b 32 30 31 Sequence of hex codes: 7e Sequence of hex codes: 18 Sequence of hex codes: e 293 characters, PuTTY: doug@s19:~/c$ cat TRAIL-putty-293 HAVE_SET_ESCDELAY : set to: 9000 Sequence of hex codes: 102 Sequence of hex codes: 102 Sequence of hex codes: 19a Sequence of hex codes: 1b 5b 32 30 30 7e 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 1b 5b 32 30 31 7e Sequence of hex codes: 18 Sequence of hex codes: e