Forráskód Böngészése

previous approach actually wasn't working

Daniel Sheffield 3 hónapja
szülő
commit
3b153b8d5f
1 módosított fájl, 8 hozzáadás és 5 törlés
  1. 8 5
      rc/.bashrc

+ 8 - 5
rc/.bashrc

@@ -1,9 +1,12 @@
 #TODO: path must be install location
 #TODO: path must be install location
 . "$HOME"/git/recall/rc/.shrc
 . "$HOME"/git/recall/rc/.shrc
 
 
-insert() {
-	bind $'"\u200b":"'"$zle_prefix"'"'
-	perl -le 'require "sys/ioctl.ph";
-ioctl(STDIN, &TIOCSTI, $_) for split "", join " ", @ARGV' -- "$@"
+insert_with_delay() {
+  perl -le 'require "sys/ioctl.ph";
+            $delay = shift @ARGV;
+            unless(fork) {
+              select undef, undef, undef, $delay;
+              ioctl(STDIN, &TIOCSTI, $_) for split "", join " ", @ARGV;
+            }' -- "$@";
 }
 }
-PROMPT_COMMAND="[ \"$zle_prefix\" ] && insert $'\u200b'"
+PROMPT_COMMAND='insert_with_delay 0.05 "$zle_prefix"'