Arrow keys, <Home> and <End> do not work in man #5

Closed
opened 2022-04-07 00:34:11 +02:00 by christian · 5 comments
  • though <PgUp> and <PgDn> work just fine
* though `<PgUp>` and `<PgDn>` work just fine
Poster
Owner

Program less is affected, too. But in ncte and pangoterm, both using an older and the same library version respectively, it works.

Program `less` is affected, too. But in `ncte` and `pangoterm`, both using an older and the same library version respectively, it works.
Poster
Owner

In less you can see the ANSI escape sequences, when holding the key long enough — not sure if sequence is complete.

Key Escape sequence Correct escape sequence?
ESC[D
ESC[A
ESC[C
ESC[B
ESC[H
ESC[F
ESC[H
ESC[5~ already correct
ESC[6~ already correct
In `less` you can see the ANSI escape sequences, when holding the key long enough — not sure if sequence is complete. | Key | Escape sequence | Correct escape sequence? | | ----| --------------- | ------------------------ | | ← | ESC\[D | | | ↑ | ESC\[A | | | → | ESC\[C | | | ↓ | ESC\[B | | | ⇱ | ESC\[H | | | ⇲ | ESC\[F | | | ⇱ | ESC\[H | | | ↟ | ESC\[5~ | already correct | | ↡ | ESC\[6~ | already correct |
Poster
Owner

Taking it back … ncte also does not work. Getting at least a bell.

But still, it works in pangoterm (Ubuntu version 0~bzr613-1), which uses the same version of libvterm (Ubuntu version 0.1.2-2) as NCursesPtyWindow.

Taking it back … `ncte` also does not work. Getting at least a bell. But still, it works in `pangoterm` (Ubuntu version 0~bzr613-1), which uses the same version of `libvterm` (Ubuntu version 0.1.2-2) as `NCursesPtyWindow`.
Poster
Owner

So, after some investigation into pangoterm it seems, that less communicates to the terminal to switch the standard (and thus the escape sequence for certain keys). less does the switch most likely by some termio magic.

Key Escape sequence Correct escape sequence
<ESC>[D <ESC>OD
<ESC>[A <ESC>OA
<ESC>[C <ESC>OC
<ESC>[B <ESC>OB
<ESC>[H <ESC>OH
<ESC>[F <ESC>OF
<ESC>[5~ already correct
<ESC>[6~ already correct

Problem is: Even if ncurses could handle the switch (I don't know if ), it never sees this switch, because libvterm handles it.

So the solution is to recognize the keys with ncurses and translate them to libvterm.

So, after some investigation into `pangoterm` it seems, that `less` communicates to the terminal to switch the standard (and thus the escape sequence for certain keys). `less` does the switch most likely by some termio magic. | Key | Escape sequence | Correct escape sequence | | ----| --------------- | ------------------------ | | ← | \<ESC>\[D | \<ESC>OD | | ↑ | \<ESC>\[A | \<ESC>OA | | → | \<ESC>\[C | \<ESC>OC | | ↓ | \<ESC>\[B | \<ESC>OB | | ⇱ | \<ESC>\[H | \<ESC>OH | | ⇲ | \<ESC>\[F | \<ESC>OF | | ↟ | \<ESC>\[5~ | already correct | | ↡ | \<ESC>\[6~ | already correct | Problem is: Even if `ncurses` could handle the switch (I don't know if ), it never sees this switch, because `libvterm` handles it. So the solution is to recognize the keys with `ncurses` and translate them to `libvterm`.
christian referenced this issue from a commit 2022-04-13 10:48:23 +02:00
Poster
Owner

Final thoughts: There is something called "keyboard_transmit mode". Which can be enabled and changes the escape sequences for various function keys. This was probably happening.

See: https://stackoverflow.com/questions/18658513/determining-escape-sequences-for-cursor-keys-canonically

Final thoughts: There is something called "`keyboard_transmit` mode". Which can be enabled and changes the escape sequences for various function keys. This was probably happening. See: https://stackoverflow.com/questions/18658513/determining-escape-sequences-for-cursor-keys-canonically
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: christian/kNCurses#5
There is no content yet.