Skip to content

Commit

Permalink
Fix parsing bug in bind -n
Browse files Browse the repository at this point in the history
Fixes #20.
  • Loading branch information
marlonrichert committed Dec 14, 2023
1 parent 14c7cd5 commit 113a0d5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
15 changes: 15 additions & 0 deletions .clitest/bind.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,21 @@
"^X}" Control-X + }
"^X~" Control-X + ~
"^X^?" Control-X + Backspace
% COLUMNS=40 key= bind -n '^['{\[,O}{{A..D},F,H,Z}
"^[[A" Up
"^[[B" Down
"^[[C" Right
"^[[D" Left
"^[[F" End
"^[[H" Home
"^[[Z" Shift-Tab
"^[OA" Up
"^[OB" Down
"^[OC" Right
"^[OD" Left
"^[OF" End
"^[OH" Home
"^[OZ" Shift-Tab
% COLUMNS=40 key= bind -n '^[[1;'{2..16}{A,B,C,D,F,H}
"^[[1;2A" Shift-Up
"^[[1;2B" Shift-Down
Expand Down
4 changes: 2 additions & 2 deletions functions/bind
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ elif [[ -v opts[-n] ]]; then
[[ -n $name && $name != *- ]] &&
name+=' + '
case $code in
( (#b)($'\e'[\[O]([ABCDFH]))* )
( (#b)($'\e'[\[O]([ABCDFHZ]))* )
case $match[2] in
( A ) name+='Up' ;;
( B ) name+='Down' ;;
( C ) name+='Right' ;;
( D ) name+='Left' ;;
( E ) name+='End' ;;
( F ) name+='End' ;;
( H ) name+='Home' ;;
( Z ) name+='Shift-Tab' ;;
esac
Expand Down

0 comments on commit 113a0d5

Please sign in to comment.