bugGNU nano - Bugs: bug #58731, typing <Alt+operator> on the...

 
 

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

bug #58731: typing <Alt+operator> on the numeric keypad enters unwanted letter

Submitter:  Benno Schulenberg <bens>
Submitted:  Wed 08 Jul 2020 12:04:17 PM UTC
   
 
Severity:  2 - Minor Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Sat 11 Jul 2020 02:27:36 PM UTC, comment #4: 

Fixed in git, commit ecb4dac4, by making <Alt+operator> and <Ctrl+operator> enter simply the operator itself.

Benno Schulenberg <bens>
Group administrator
Thu 09 Jul 2020 02:56:25 PM UTC, comment #3: 

(Hrm!  My comment got truncated because I had mistyped the closing verbatim tag. :/ )

An explanation of the extra "3" in the "Esc O 3 x" sequences is given on https://invisible-island.net/xterm/ctlseqs/ctlseqs.html (search for "xterm encodes").  There it says:

In normal mode, [...], xterm encodes function key modifiers as parameters appended before the final character of the control sequence.

(I would have said "inserted" instead of "appended", but fine, at least it is explained somewhere.)

So the "3" before the final letter means Alt is pressed, "5" means Ctrl, and "2" would mean Shift (I haven't checked that yet).  So... nano needs to recognize still more escape sequences.  :|

Benno Schulenberg <bens>
Group administrator
Thu 09 Jul 2020 02:53:28 PM UTC, comment #2: 

An explanation of the extra "3" in the "Esc O 3 x" sequences is given on https://invisible-island.net/xterm/ctlseqs/ctlseqs.html (search for "xterm encodes").  There it says:

In normal mode, [...], xterm encodes function key modifiers as parameters appended before the final character of the control sequence.
-verbatim_
(I would have said "inserted" instead of "appended", but fine, at least it is explained somewhere.)

So the "3" before the final letter means Alt is pressed, "5" means Ctrl, and "2" would mean Shift (I haven't checked that yet).  So... nano needs to recognize still more escape sequences.  :|

Benno Schulenberg <bens>
Group administrator
Wed 08 Jul 2020 12:21:07 PM UTC, comment #1: 

A more autorative source for the keypad codes: https://vt100.net/docs/vt100-ug/chapter3.html#T3-8.  (The VT100 had a very small keypad, without / and * and +: https://en.wikipedia.org/wiki/VT100.)

Benno Schulenberg <bens>
Group administrator
Wed 08 Jul 2020 12:04:17 PM UTC, original submission:  

To reproduce, take a keyboard that has a numeric keypad on it, run 'src/nano --ignore', and type on the keypad (with NumLock off):
<Alt+/> <Alt+*> <Alt+-> <Alt++> <Alt+Enter>
See how this enters: ojmkM into the buffer.  :|

I'm not sure what nano should do for these key combinations, but for sure it should not enter a seemingly random letter into the buffer.

Bug exists since version 2.9.3.  Before that, nano would say "Unknown sequence" for those keystrokes.  The offending commit is e734488c: "consume only the actual length of an escape sequence".

When using --raw, it works fine.  But the weird thing is: when using --raw, those keys on the keypad do NOT produce an escape sequence but simply the relevant ASCII code.  But without --raw (when nano uses keypad mode, which ought to mean that ncurses translates escape sequences to single keycodes), ncurses DOES produce escape sequences for those keys.  :|  As follows:

Alt+/: Esc O 3 o
Alt+*: Esc O 3 j
Alt+-: Esc O 3 m
Alt++: Esc O 3 k
Alt+Enter: Esc O 3 M

Nano does not recognize these.  Nano knows similar sequences: with the "3" elided, as that seem to be the proper VT100 sequences (see http://ascii-table.com/ansi-escape-sequences-vt-100.php).

(When using Ctrl instead of Alt, ncurses replaces the 3 with a 5.)

Benno Schulenberg <bens>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-07-30 bens Open/ClosedOpen Closed
    2020-07-17 bens Summarytyping &lt;Alt+operator&gt; on the numeric keypad enters a letter typing <Alt+operator> on the numeric keypad enters unwanted letter
    2020-07-11 bens Severity3 - Normal 2 - Minor
        StatusIn Progress Fixed
    2020-07-09 bens StatusNone In Progress
    2020-07-08 bens Assigned toNone bens

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code