bugGNU nano - Bugs: bug #61573, on a Linux console, ^Z cannot be...

 
 

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

bug #61573: on a Linux console, ^Z cannot be rebound

Submitter:  Benno Schulenberg <bens>
Submitted:  Sat 27 Nov 2021 12:53:30 PM UTC
   
 
Severity:  3 - Normal Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Sat 27 Nov 2021 03:58:05 PM UTC, comment #2: 

Fixed in git, commit be87f110, by translating KEY_SUSPEND back to the code for Ctrl+Z: 0x1A.

(Weirdly, before version 2.7.0, rebinding ^Z would result in ^Z performing the next-word function when on a VT.  :|  I don't remember whether there was a bug report for that or whether this was fixed as a side effect of something else.  Probably the latter, otherwise I should have realized that the fix was incomplete.)

Benno Schulenberg <bens>
Group administrator
Sat 27 Nov 2021 01:58:04 PM UTC, comment #1: 

Nano receiving KEY_SUSPEND when ^Z is typed on a VT also means that rebinding ^Z will not have any effect on a Linux console.  This is unexpected and unwanted.  (To check this, add 'bind ^Z undo main' at the end of your ~/.nanorc, run src/nano, and type ^Z.  Result: nano suspends instead of saying "Nothing to undo".)

Expected behavior: also on a Linux console ^Z should be rebindable.

The correct solution would be to translate KSUSPEND back to whatever keycode it was translated from, but that seems impossible: what if it were an escape sequence that was translated to KSUSPEND?

So, as I don't know of any keyboard that has a Suspend key (some keyboards have a Pause key, but mine don't, and I doubt it sends anything that gets translated to KEY_SUSPEND -- it might send a SIGSTOP, though, I will have to try on some other machine), the only solution seems to be to translate KEY_SUSPEND back to ^Z.

Benno Schulenberg <bens>
Group administrator
Sat 27 Nov 2021 12:53:30 PM UTC, original submission:  

To reproduce, run 'src/nano --ignore' on a Linux console (a VT), and type ^Z.  See that nano goes into suspension instead of reporting on the status bar: "[ To suspend, type ^T^Z ]".

Continue with: fg <Enter> ^X.  Now run 'src/nano --ignore --raw' and type ^Z.  See that nano now reports "[ To suspend, type ^T^Z ]".

The thing is: the terminfo entry for linux contains "kspd=^Z" (to check, run 'infocmp | grep kspd'), which means that ncurses will send KSUSPEND (instead of 0x1A) to nano when the user type Ctrl+Z.

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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-12-16 bens Open/ClosedOpen Closed
    2021-11-27 bens StatusNone Fixed
    2021-11-27 bens Summaryon a Linux consolse, ^Z will still suspend nano on a Linux console, ^Z cannot be rebound

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code