nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nano-devel] [PATCH] delete a marked region or line without affectin


From: David Ramsey
Subject: Re: [Nano-devel] [PATCH] delete a marked region or line without affecting the cutbuffer
Date: Thu, 25 Oct 2018 14:58:41 -0500

Benno Schulenberg:
> It would be easier to review if you send it here (preferrably with
> git-send-email, but otherwise as attachment(s)).

I sent it to the the Savannah bug because the other 3 parts it depends
on are there, and I haven't used git-send-email before.  Having
different parts of the same patchset in two different places would make
things more confusing.

I'll look into git-send-email soon.  For now, I'm attaching v3 of my
patch with your changes below melded, and also attaching it to the bug
report.

> Huh?  get_byte_kbinput() is meant for assembling a three-digit code
> into a single character.  It has no place here.  When I change this
> and the subsequent fragment to the following, it works:

+           } else if (keycode == '[' && key_buffer_len > 1 &&
+                       key_buffer[0] == '3' && key_buffer[1] == '~') {
+               /* Consume the two waiting codes. */
+               kbinput = get_input(win, 1);
+               kbinput = get_input(win, 1);
+               retval = ALT_DELETE;
+               escapes = 0;

I'm a bit rusty with regard to that part of the code; thanks.  v3
includes this (although I've also retained my own comment documenting
what urxvt generates), and adds the missing NANO_TINY #ifdefs.

> In urxvt, when you hold Alt (Meta) with a keystroke, it simply
> precedes the code (or the escape sequence) of the keystroke with an
> escape char. In the case of an escape sequence this leads to a double
> escape, which is... simply wrong -- after an escape only printable
> ASCII characters should follow.
>
> One could argue that this is a bug in ncurses, because by default nano
> requests keypad mode, which says that each (modified) keystroke will
> result in a single-integer keycode.  But for urxvt, for the
> Alt-modified editing keys, this is not the case: ncurses lets the
> first escape pass (presumably because escape escape is not a valid
> sequence) and then recognizes the sequence for the unmodified key and
> passes the single-integer code for it on.

That also assumes that the terminfo entry for urxvt is correct.  If it
isn't, you'll get the raw escape sequence regardless.

> Googling a bit brings this:
>   https://invisible-island.net/ncurses/ncurses-urxvt.html
>
> So I doubt that asking the ncurses maintainer to start recognizing the
> double escape sequences that urxvt emits will have any result.

Yikes.

> Luckily, there is no need to.  Urxvt users can help themselves:

<snip .Xresources stuff>

Is this a common enough problem that it should be in the FAQ?

Attachment: zap-0004-input-properly-read-Alt-Delete-when-using-K-rebindkey-v3.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]