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: Benno Schulenberg
Subject: Re: [Nano-devel] [PATCH] delete a marked region or line without affecting the cutbuffer
Date: Thu, 25 Oct 2018 21:09:04 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1

Op 24-10-18 om 17:45 schreef David Ramsey:
> I've also added a new fourth patch there.

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

> It should make
> -K/--rebindkeypad read M-Del under urxvt as well as the other terminals,
> but it probably needs testing.

You have in there:

+           } else if (keycode == '[' && key_buffer_len > 0 &&
+                       *key_buffer == '3') {
+               int byte = get_byte_kbinput(keycode);

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;

But, as you mentioned in https://savannah.gnu.org/bugs/?54837, urxvt
seems to have issue with modified keystrokes.

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.

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.

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

  nano ~/.Xresources

and add the line:


  URxvt.keysym.M-Delete: \033[3;3~

(Similar lines can be added for the Alt+arrow keys to get rid of
the other double escapes.)

and then run:

  xrdb ~/.Xresources

After which urxvt will emit the normal xterm escape sequence for
Alt+Delete and nano will recognize it (after the second fragment
of David's patch has been applied).

Benno

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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