From: Wayne Davison <wayne@clari.net>
To: zsh-workers@math.gatech.edu
Subject: I-Search improvement
Date: Thu, 11 Jul 1996 13:51:17 -0700 [thread overview]
Message-ID: <199607112051.NAA09738@bebop.clari.net> (raw)
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---
next reply other threads:[~1996-07-11 21:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-07-11 20:51 Wayne Davison [this message]
1996-07-12 16:51 ` Zoltan Hidvegi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199607112051.NAA09738@bebop.clari.net \
--to=wayne@clari.net \
--cc=zsh-workers@math.gatech.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).