Make <ctrl>+<left arrow> and <ctrl>+<right arrow> work

On many systems <ctrl>+<left arrow> and <ctrl>+<right arrow> are mapped
to make the cursor move a word back and forward respectively. This is
done by mapping the `\e[1;5C` and `\e[1;5D` sequences.

This patch maps those sequences in this readline implementation as well.
This commit is contained in:
Dennis Kaarsemaker 2019-11-21 18:42:38 +01:00
parent 2972be24d4
commit faa1e4de0d
1 changed files with 6 additions and 0 deletions

View File

@ -102,8 +102,14 @@ func escapeExKey(key *escapeKeyPair) rune {
switch key.typ { switch key.typ {
case 'D': case 'D':
r = CharBackward r = CharBackward
if key.attr == "1;5" {
r = MetaBackward
}
case 'C': case 'C':
r = CharForward r = CharForward
if key.attr == "1;5" {
r = MetaForward
}
case 'A': case 'A':
r = CharPrev r = CharPrev
case 'B': case 'B':