about summary refs log tree commit diff
path: root/Test/X03zlebindkey.ztst
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2022-12-16 23:12:54 +0100
committerOliver Kiddle <opk@zsh.org>2022-12-16 23:23:53 +0100
commit7fb6c133bfdf445b4478897adc142ed7d07b5fd6 (patch)
treeca243280f870eefa26da8570f3c808d0a02ddb95 /Test/X03zlebindkey.ztst
parent1de8baded2c3f4b8facdaf8f5bc5ffb392e73199 (diff)
downloadzsh-7fb6c133bfdf445b4478897adc142ed7d07b5fd6.tar.gz
zsh-7fb6c133bfdf445b4478897adc142ed7d07b5fd6.tar.xz
zsh-7fb6c133bfdf445b4478897adc142ed7d07b5fd6.zip
51215: consume whole CSI sequences from the input
This affects CSI sequences that aren't explicitly bound but arrive
within the usual KEYTIMEOUT time limits. A single undefined-key widget
is run instead of unintended bindings for Escape and other characters in
the sequence.
Diffstat (limited to 'Test/X03zlebindkey.ztst')
-rw-r--r--Test/X03zlebindkey.ztst22
1 files changed, 22 insertions, 0 deletions
diff --git a/Test/X03zlebindkey.ztst b/Test/X03zlebindkey.ztst
index 5277332a7..1b63b3920 100644
--- a/Test/X03zlebindkey.ztst
+++ b/Test/X03zlebindkey.ztst
@@ -37,6 +37,28 @@
 >"^Xy" "bar"
 >"^Xy" undefined-key
 
+  zpty_run 'bindkey -s "\e[" altbracket'
+  zletest $'$\C-A\e[17~'
+  zpty_run 'bindkey -r "\e["'
+0:binding to CSI introduction is not used if a full sequence arrives
+>BUFFER: $
+>CURSOR: 0
+
+  zpty_run 'bindkey -s "\e[1" altbracketone'
+  zletest $'$\C-A\e[17~'
+  zpty_run 'bindkey -r "\e[1"'
+0:binding to longer prefix of a CSI sequence is used
+# we assume the user knows what they're doing
+>BUFFER: altbracketone7~$
+>CURSOR: 15
+
+  zpty_run 'bindkey -s "\e[" altbracket'
+  zletest $'$\C-A\e[177'
+  zpty_run 'bindkey -r "\e["'
+0:use prefix binding where we don't have a CSI sequence
+>BUFFER: altbracket177$
+>CURSOR: 13
+
 # As we're only looking at definitions here, we don't
 # bother using the pseudo-terminal; just test in the normal fashion.
   bindkey -e