Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: key delays in zle tests (was fix vi-indent and vi-swap-case)

I wrote:
> No test for vi-swap-case because _bash_completions is getting in
> the way to do username completion on \e~. Any idea how we can get
> zletest to sleep for a $KEYTIMEOUT delay?

This allows zletest to take multiple arguments and it puts a delay
between each argument. I set KEYTIMEOUT to 1 to avoid slowing the tests
needlessly. We can always increase it if necessary.

For the delay, I've had to use read because sleep with a fraction
argument is not portable. Maybe we should make it a loadable builtin.

On the subject of KEYTIMEOUT, any thoughts on perhaps adding a separate
ESCTIMEOUT to set a different timeout specifically for an Escape (or
some other variable name)? Do you emacs mode users type Escape then Key or is
it mostly Alt/Meta? We could perhaps use different defaults for vi and
emacs mode.


diff --git a/Test/X02zlevi.ztst b/Test/X02zlevi.ztst
index 4210a72..297fb9ae 100644
--- a/Test/X02zlevi.ztst
+++ b/Test/X02zlevi.ztst
@@ -37,6 +37,12 @@
+  zletest $'\e' $'~aI\e' $'~o\e' \~
+0:swap case on a blank line
   zletest $' four\eO\C-v\tthree\eO  two\eOone\e3J'
 0:join lines with line count
 >BUFFER: one two three
diff --git a/Test/comptest b/Test/comptest
index 96072fd..654c0f1 100644
--- a/Test/comptest
+++ b/Test/comptest
@@ -36,6 +36,7 @@ comptestinit () {
 stty 38400 columns 80 rows 24 werase undef
 setopt zle
 autoload -U compinit
 compinit -u
@@ -159,9 +160,14 @@ comptest () {
 zletest () {
-  input="$*"
-  # zpty_flush Before zletest
-  zpty -n -w zsh "$input"$'\C-X'
+  local first=0
+  for input; do
+    # sleep for $KEYTIMEOUT
+    (( first++ )) && read -t 0.011 -k 1 < /dev/null
+    # zpty_flush Before zletest
+    zpty -n -w zsh "$input"
+  done
+  zpty -n -w zsh $'\C-X'
   zpty -r -m zsh log "*<WIDGET><finish>*<PROMPT>*" || {
     print "failed to invoke finish widget."
     return 1

Messages sorted by: Reverse Date, Date, Thread, Author