bugGNU nano - Bugs: bug #54948, when using -K,...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #54948: when using -K, <Shift+Delete> says "Unknown sequence"

Submitted by:  Benno Schulenberg <bens>
Submitted on:  Sun 04 Nov 2018 10:52:43 AM UTC  
 
Severity:  2 - Minor Status:  Fixed
Assigned to:  David Lawrence Ramsey <dolorous> Open/Closed:  Closed

( Jump to the original submission)

Wed 07 Nov 2018 08:26:40 PM UTC, comment #12: 

Done.  (I know that the patch should be as small as possible.  However, you also said you didn't like splitting up the NANO_TINY #ifdef, but I can't think of another way to fix it without doing the latter.)

David Lawrence Ramsey <dolorous>
Project MemberIn charge of this item.
Wed 07 Nov 2018 07:40:52 PM UTC, comment #11: 

(The modified <Delete> key entering spurious stuff into the buffer in the tiny version is a separate bug.  Please report.  A patch should include in the tiny version the least amount of code to avoid the spurious stuff.)

Benno Schulenberg <bens>
Project Administrator
Wed 07 Nov 2018 06:58:48 PM UTC, comment #10: 

Thanks.  I'm not that familiar with the Linux console bits.

David Lawrence Ramsey <dolorous>
Project MemberIn charge of this item.
Wed 07 Nov 2018 06:20:04 PM UTC, comment #9: 

Fixed in git, commit f55a3fab.  Thanks for the patch.

(I've amended the patch: Shift+Delete should work also on the Linux console (I think you misunderstod what I said about the "& 01"), and "Sh-Del" too needs to be colored in the help text.)

Benno Schulenberg <bens>
Project Administrator
Wed 07 Nov 2018 03:18:49 PM UTC, comment #8: 

(Crossreference: the Backspace key not working in help viewer and file browser has been reported as bug #54978.)

Benno Schulenberg <bens>
Project Administrator
Wed 07 Nov 2018 12:40:46 AM UTC, comment #7: 

And reported the other bug separately, with more details.  Depending on the terminal you're using, it either works in the help viewer but not in the file browser, or doesn't work in either the help viewer or file browser.

David Lawrence Ramsey <dolorous>
Project MemberIn charge of this item.
Wed 07 Nov 2018 12:21:47 AM UTC, comment #6: 

Attached new version, resynced against git 7ee07af.  The code asking ncurses for the key is gone, as is the modifier handling.

Also, the NANO_TINY #ifdefs are no longer shifted.  This also means that, in tiny mode without -K, Shift-Delete will still act like Delete; with -K, the escape sequence handling for all modified versions of Delete will be left out, so you'll get "Unknown sequence" and the characters "2~" will be inserted.  "3~" will be inserted for Alt-Delete, "5~" for Ctrl-Delete, and "6~" for Ctrl-Shift-Delete.  (Not handling modified Delete is understandable in tiny mode, as you point out, but inserting characters when pressing unknown sequences seems problematic to me.)

By the way, your sequence of hex codes on FreeBSD is "Esc [ 3 ; 2 ~", which this patch should interpret as Shift-Delete, barring the tiny mode caveat above.

(file #45377)

David Lawrence Ramsey <dolorous>
Project MemberIn charge of this item.
Tue 06 Nov 2018 08:13:56 PM UTC, comment #5: 

(On FreeBSD, even without -K <Shift+Delete> says unknown sequence.  The sequence of hex codes it sees is: 1b  5b  33  3b  32  7e.)

Benno Schulenberg <bens>
Project Administrator
Tue 06 Nov 2018 07:54:55 PM UTC, comment #4: 

Oh, and yes, please report the other bug separately.  I already know how to fix it.  (For me, <Backspace> still works in the help viewer, but it has been broken in the file browser since version 2.9.2.)

Benno Schulenberg <bens>
Project Administrator
Tue 06 Nov 2018 06:41:53 PM UTC, comment #3: 

Hmmm...  It should not be necessary to ask ncurses for the keycode for the shifted Delete key, because it has a code by default: KEY_SDC.

Also,

+           if ((modifiers & 0x01) == 0x01)
+               return SHIFT_DELETE;

is not right.  If Ctrl+Shift+Delete is pressed, it will now be recognized as Shift+Delete.

(I think the (modifiers & 0x05)in the next line is wrong too.  I don't know why the & 0x05 is there.)

And please don't change the TINY ifdefs, it just obscures the changes.  I don't care if some things are not available in the tiny version.  Maybe even more things should be excluded: the point of tiny is to be tiny and just offer basic editing.  A shifted Delete key acting as Backspace is, to my mind, just a silly unneeded extra.

(BTW, I have the intention, in a future version, to remove the --rebindkeypad option.  The whole point of calling keypad() is to have ncurses do the translation of escape sequences to keycodes for us.  Only for the exceptional cases where ncurses does not recognize the sequence, like the double escape stuff of urxvt, nano could be friendly and recognize those.  All the normal sequences that ncurses knows can be scrapped from nano.  Maybe in the past there were faulty terminal definitions, but if there are still some left, I want people to report the problem instead of nano silently working around it for them.)

Benno Schulenberg <bens>
Project Administrator
Tue 06 Nov 2018 02:51:12 AM UTC, comment #2: 

(And, for the record, I haven't reported the other problem as a separate bug yet because my system is currently a hybrid of Slackware 14.2 and -current, and I don't know whether it's a general problem or it's caused by my breaking something when upgrading ncurses to the version in -current.)

David Lawrence Ramsey <dolorous>
Project MemberIn charge of this item.
Tue 06 Nov 2018 01:16:44 AM UTC, comment #1: 

The attached patch, against git 362965b, should fix this, and also make Shift-Delete act as Backspace when the former is read as an escape sequence, whether nano's built with --enable-tiny or not.

(While testing this, I've also noticed another problem: according to global.c, Backspace is supposed to act as PageUp in both the help viewer and the file browser, but if I actually press Backspace in either of them, nano instead produces: "Unbound key: ^?".)

(file #45366)

David Lawrence Ramsey <dolorous>
Project MemberIn charge of this item.
Sun 04 Nov 2018 10:52:43 AM UTC, original submission:  

To reproduce, run 'nano --ignore --rebindkeypad +12 NEWS' and type <Shift+Delete>.  Nano doesn't recognize the sequence.

Benno Schulenberg <bens>
Project Administrator

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by dolorous (Updated the item)
  • -email is unavailable- added by bens (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-11-12 bens Open/ClosedOpen => Closed
    2018-11-07 bens StatusIn Progress => Fixed
    2018-11-07 dolorous Attached File- => Added 0001-input-recognize-escape-sequences-for-Shift-Delete.patch, #45377
    2018-11-06 bens StatusNone => In Progress
        Assigned toNone => dolorous
    2018-11-06 dolorous Attached File- => Added 0001-input-recognize-escape-sequences-for-Shift-Delete.patch, #45366

    Back to the top


    Powered by Savane 3.5