summaryrefslogtreecommitdiffhomepage
path: root/tests/linux/i-bind.sh
blob: 8bbc8728bd5aabc479638ee2b6fad522c2d496c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Interactive: `bind`, the key bindings of the BSD shells.
command -v python3 >/dev/null 2>&1 || exit 77
PS1='$ ' ENV='' HISTFILE='' python3 "$TESTS/tools/ptydrive.py" "$TSH" <<'END'
# -l lists what the editor can run
send bind -l | grep -c up-history\r
expect 1
# a bound sequence runs its action: ESC accepts the line
send bind '^['=accept-line\r
send echo BOUND\x1b
expect BOUND
# a key the editor knows, moved to another action: Insert recalls history
send bind '^[[2~'=up-history\r
send echo AAA\r
send echo \x1b[2~\r
expect AAA
# a name the editor does not have is an error, and binding still works
send bind '^[[2~'=nosuch\r
expect bind: nosuch: no such editing command
send bind -m '^X'=macro\r
expect bind: -m: macros are not supported
send echo STILL-OK\r
expect STILL-OK
send exit\r
END