1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-01 11:32:48 -05:00

New config option for shifted arrow key handling.

This commit introduces a new config option for how to handle shifted
arrow keys.

In the default mode (SHARROW_APPLICATION), we do what we've always
done: Ctrl flips the arrow keys between sending their most usual
escape sequences (ESC [ A ... ESC [ D) and sending the 'application
cursor keys' sequences (ESC O A ... ESC O D). Whichever of those modes
is currently configured, Ctrl+arrow sends the other one.

In the new mode (SHARROW_BITMAP), application cursor key mode is
unaffected by any shift keys, but the default sequences acquire two
numeric arguments. The first argument is 1 (reflecting the fact that a
shifted arrow key still notionally moves just 1 character cell); the
second is the bitmap (1 for Shift) + (2 for Alt) + (4 for Ctrl),
offset by 1. (Except that if _none_ of those modifiers is pressed,
both numeric arguments are simply omitted.)

The new bitmap mode is what current xterm generates, and also what
Windows ConPTY seems to expect. If you start an ordinary Command
Prompt and launch into WSL, those are the sequences it will generate
for shifted arrow keys; conversely, if you run a Command Prompt within
a ConPTY, then these sequences for Ctrl+arrow will have the effect you
expect in cmd.exe command-line editing (going backward or forward a
word). For that reason, I enable this mode unconditionally when
launching Windows pterm.
This commit is contained in:
Simon Tatham
2021-10-18 20:00:25 +01:00
parent c35d8b8328
commit 22911ccdcc
11 changed files with 74 additions and 8 deletions

View File

@ -599,6 +599,24 @@ to \c{ESC [v}, and with shift and control together they generate
If you don't know what any of this means, you probably don't need to
fiddle with it.
\S{config-sharrow} Changing the action of the \i{shifted arrow keys}
This option affects the arrow keys, if you press one with any of the
modifier keys Shift, Ctrl or Alt held down.
\b In the default mode, labelled \c{Ctrl toggles app mode}, the Ctrl
key toggles between the default arrow-key sequnces like \c{ESC [A} and
\c{ESC [B}, and the sequences Digital's terminals generate in
\q{application cursor keys} mode, i.e. \c{ESC O A} and so on. Shift
and Alt have no effect.
\b In the \q{xterm-style bitmap} mode, Shift, Ctrl and Alt all
generate different sequences, with a number indicating which set of
modifiers is active.
If you don't know what any of this means, you probably don't need to
fiddle with it.
\S{config-appcursor} Controlling \i{Application Cursor Keys} mode
Application Cursor Keys mode is a way for the server to change the

View File

@ -931,3 +931,6 @@ saved sessions from
\IM{system tray} system tray, Windows
\IM{system tray} notification area, Windows (aka system tray)
\IM{system tray} taskbar notification area, Windows (aka system tray)
\IM{shifted arrow keys} arrow keys, shifted
\IM{shifted arrow keys} shifted arrow keys