From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9369 invoked from network); 13 Oct 1997 15:42:10 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 13 Oct 1997 15:42:10 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id LAA27349; Mon, 13 Oct 1997 11:34:58 -0400 (EDT) Resent-Date: Mon, 13 Oct 1997 11:34:58 -0400 (EDT) Message-Id: <199710131535.RAA14039@hydra.ifh.de> To: zsh-workers@math.gatech.edu (Zsh hackers list), zsh@peak.org Subject: PATCH: 3.1.2: keyboard macros (2) [needed] Date: Mon, 13 Oct 1997 17:35:46 +0200 From: Peter Stephenson Resent-Message-ID: <"pzfZh1.0.Dh6.X-ZGq"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/3582 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu 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 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.