* PATCH: 3.1.2: keyboard macros (2) [needed]
@ 1997-10-13 15:35 Peter Stephenson
0 siblings, 0 replies; only message in thread
From: Peter Stephenson @ 1997-10-13 15:35 UTC (permalink / raw)
To: Zsh hackers list, zsh
Somehow I forgot to include the zle_keymap.c segment of the last
patch, with the bindkey changes. This also includes a bugfix: if zle
read a complete key sequence but didn't need it, such as when in
isearch the next sequence wasn't one of the ones specially handled,
you got it twice.
*** Src/Zle/zle_keymap.c.km2 Mon Oct 13 17:18:42 1997
--- Src/Zle/zle_keymap.c Mon Oct 13 17:24:06 1997
***************
*** 581,586 ****
--- 581,587 ----
{ 'A', 0, bin_bindkey_link, 2, 2 },
{ 'N', 0, bin_bindkey_new, 1, 2 },
{ 'm', 1, bin_bindkey_meta, 0, 0 },
+ { 'k', 1, bin_bindkey_bind, 1, 1 },
{ 'r', 1, bin_bindkey_bind, 1, -1 },
{ 's', 1, bin_bindkey_bind, 2, -1 },
{ 0, 1, bin_bindkey_bind, 0, -1 },
***************
*** 815,821 ****
int len;
Thingy fn;
! if(func == 'r') {
fn = refthingy(t_undefinedkey);
str = NULL;
} else if(func == 's') {
--- 816,829 ----
int len;
Thingy fn;
! if(func == 'k') {
! if (!last_macro) {
! zwarnnam(name, "no keyboard macro defined", NULL, 0);
! return 1;
! }
! fn = NULL;
! str = metafy(last_macro, last_mlen, META_DUP);
! } else if(func == 'r') {
fn = refthingy(t_undefinedkey);
str = NULL;
} else if(func == 's') {
***************
*** 1175,1180 ****
--- 1183,1192 ----
ungetkeycmd(void)
{
ungetkeys(keybuf, keybuflen);
+ /* So we don't do this twice when recording a macro, delete the
+ * first occurrence
+ */
+ macro_del(keybuflen);
}
/* read a command from the current keymap, with widgets */
*** Src/Zle/zle_utils.c.km2 Mon Oct 13 17:20:45 1997
--- Src/Zle/zle_utils.c Mon Oct 13 17:28:16 1997
***************
*** 653,658 ****
--- 653,670 ----
/**/
void
+ macro_del(int nc)
+ {
+ if (!macro_record)
+ return;
+ if (nc > macro_ptr - cur_macro)
+ cur_startseq = macro_ptr = cur_macro;
+ else
+ macro_ptr -= nc;
+ }
+
+ /**/
+ void
macro_startseq(void)
{
cur_startseq = macro_ptr;
--
Peter Stephenson <pws@ifh.de> Tel: +49 33762 77366
WWW: http://www.ifh.de/~pws/ Fax: +49 33762 77413
Deutsches Elektronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, Platanenallee 6, 15738 Zeuthen, Germany.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1997-10-13 15:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-10-13 15:35 PATCH: 3.1.2: keyboard macros (2) [needed] Peter Stephenson
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).