Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
I-Search improvement
- X-seq: zsh-workers 1613
- From: Wayne Davison <wayne@xxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx
- Subject: I-Search improvement
- Date: Thu, 11 Jul 1996 13:51:17 -0700
This patch improves the ability of a command that ends an incremental search
to be executed. Previously only single-character commands were executed,
but with this command you can type Esc-d or whatever and not have it feep
at you. I am assuming that the string "keybuf" in zle_main.c always
contains the last command sequence, which in my limited checking, looks to
be true.
This change adds a command called ungetkeycmd() to zle_main.c which is
called instead of ungetkey(). This eliminates the need for ungetok,
which I've removed. I also removed an extern of viins_cur_bindtab from
zle_hist.c (since it wasn't referenced) and made it static in zle_main.c
(since it is now totally local). I don't know when this extern was
removed, however (I didn't do it).
..wayne..
---8<------8<------8<------8<---cut here--->8------>8------>8------>8---
Index: Src/zle_hist.c
@@ -607,8 +607,6 @@
doisearch(1);
}
-extern int ungetok;
-
static struct isrch_spot {
int hl; /* This spot's histline */
unsigned short pos; /* The search position in our metafied str */
@@ -843,10 +841,7 @@
} else if (cmd == z_magicspace)
c = ' ';
else if (cmd != z_selfinsert) {
- if (ungetok)
- ungetkey(c);
- else
- feep();
+ ungetkeycmd();
if (cmd == z_sendbreak)
sbptr = 0;
goto brk;
@@ -944,8 +939,6 @@
setline(s);
}
}
-
-extern int viins_cur_bindtab[];
/**/
int
Index: Src/zle_main.c
@@ -49,7 +49,7 @@
#include "zsh.h"
static int emacs_cur_bindtab[256], eofchar, eofsent;
-int viins_cur_bindtab[256], ungetok; /* needed in zle_hist */
+static int viins_cur_bindtab[256];
static Key cky;
@@ -527,7 +527,6 @@
int lastlen = 0, t0 = 1, firstc = c;
Key ky;
- ungetok = 0;
if ((cky = (Key) keybindtab->getnode(keybindtab, keybuf))->func == z_undefinedkey)
cky = NULL;
else
@@ -565,8 +564,7 @@
} else
return z_undefinedkey;
}
- } else
- ungetok = 1; /* for doisearch() */
+ }
if (ret == z_executenamedcmd && !statusline) {
while(ret == z_executenamedcmd)
ret = executenamedcommand("execute: ");
@@ -590,6 +588,14 @@
ret = (lastcmd & ZLE_DIGIT) ? z_digitargument : z_vibeginningofline;
return ret;
}
+
+/**/
+void
+ungetkeycmd(void)
+{
+ ungetkeys(keybuf, strlen(keybuf));
+}
+
/**/
void
---8<------8<------8<------8<---cut here--->8------>8------>8------>8---
Messages sorted by:
Reverse Date,
Date,
Thread,
Author