* I-Search improvement
@ 1996-07-11 20:51 Wayne Davison
1996-07-12 16:51 ` Zoltan Hidvegi
0 siblings, 1 reply; 2+ messages in thread
From: Wayne Davison @ 1996-07-11 20:51 UTC (permalink / raw)
To: zsh-workers
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---
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: I-Search improvement
1996-07-11 20:51 I-Search improvement Wayne Davison
@ 1996-07-12 16:51 ` Zoltan Hidvegi
0 siblings, 0 replies; 2+ messages in thread
From: Zoltan Hidvegi @ 1996-07-12 16:51 UTC (permalink / raw)
To: Wayne Davison; +Cc: zsh-workers
> 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.
Yes it is true. This was not always true. It become true sometime when I
created describe-key-briefly.
> + ungetkeys(keybuf, strlen(keybuf));
That should be something like
> + ungetkeys(keybuf, (len = strlen(keybuf)) ? len : 1);
to handle the case when keybuf contains the null character which is
handled in a quited unique way here. Meta is not used so only the first
character of keybuf can be null. In a multi-character binding null's are
replaced by (char)0x80. I'll include this patch with this change.
Zoltan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1996-07-12 17:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-07-11 20:51 I-Search improvement Wayne Davison
1996-07-12 16:51 ` Zoltan Hidvegi
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).