From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gatech.edu (gatech.edu [130.207.244.244]) by werple.mira.net.au (8.6.12/8.6.9) with SMTP id EAA02493 for ; Mon, 24 Jul 1995 04:40:50 +1000 Received: from math (math.skiles.gatech.edu) by gatech.edu with SMTP id AA04300 (5.65c/Gatech-10.0-IDA for ); Sun, 23 Jul 1995 14:42:03 -0400 Received: by math (5.x/SMI-SVR4) id AA00183; Sun, 23 Jul 1995 14:38:06 -0400 Resent-Date: Sun, 23 Jul 1995 18:49:40 +0100 (BST) Old-Return-Path: From: Zefram Message-Id: <16240.199507231749@stone.dcs.warwick.ac.uk> Subject: execute-named-cmd fixes To: zsh-workers@math.gatech.edu (Z Shell workers mailing list) Date: Sun, 23 Jul 1995 18:49:40 +0100 (BST) X-Loop: zefram@dcs.warwick.ac.uk X-Stardate: [-31]6023.71 Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-Id: <"eC1bg.0.i2.DSf4m"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/264 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu -----BEGIN PGP SIGNED MESSAGE----- The patch below changes some of the logic in getkeycmd(), so that (I think) *all* commands now work with execute-named-cmd. Previously, execute-named-cmd, execute-last-named-cmd and vi-digit-or-beginning-of-line didn't work, and send-string caused a core dump. There is also a little fix for vi-forward-char. -zefram *** 1.7 1995/07/22 20:24:09 --- Src/zle_main.c 1995/07/23 17:39:55 *************** *** 539,551 **** zfree(buf, buflen); } else ungetok = 1; /* for doisearch() */ ! if (ret == z_vidigitorbeginningofline) ! ret = (lastcmd & ZLE_DIGIT) ? z_digitargument : z_vibeginningofline; ! else if (ret == z_executenamedcmd && !statusline) ! ret = executenamedcommand("execute: "); ! else if (ret == z_executelastnamedcmd) ret = lastnamed; ! else if (ret == z_sendstring) { #define MAXHOPS 20 if (++hops == MAXHOPS) { zerr("string inserting another one too many times", NULL, 0); --- 539,555 ---- zfree(buf, buflen); } else ungetok = 1; /* for doisearch() */ ! if (ret == z_executenamedcmd && !statusline) { ! while(ret == z_executenamedcmd) ! ret = executenamedcommand("execute: "); ! if(ret == -1) ! ret = z_undefinedkey; ! else if(ret != z_executelastnamedcmd) ! lastnamed = ret; ! } ! if (ret == z_executelastnamedcmd) ret = lastnamed; ! if (ret == z_sendstring) { #define MAXHOPS 20 if (++hops == MAXHOPS) { zerr("string inserting another one too many times", NULL, 0); *************** *** 554,559 **** --- 558,565 ---- } } else hops = 0; + if (ret == z_vidigitorbeginningofline) + ret = (lastcmd & ZLE_DIGIT) ? z_digitargument : z_vibeginningofline; return ret; } *************** *** 568,574 **** buf[1] = '\0'; cky = (Key) keybindtab->getnode(keybindtab, buf); } ! ungetkeys(cky->str, cky->len); } /**/ --- 574,583 ---- buf[1] = '\0'; cky = (Key) keybindtab->getnode(keybindtab, buf); } ! if(cky) ! ungetkeys(cky->str, cky->len); ! else ! feep(); } /**/ *************** *** 1098,1111 **** { int i; ! if ((func = executenamedcommand("Where is: ")) == z_undefinedkey) return; funcfound = 0; trashzle(); clearflag = (isset(USEZLE) && termok && (isset(ALWAYSLASTPROMPT) && mult == 1)) || (unset(ALWAYSLASTPROMPT) && mult != 1); ! if (func == z_selfinsert) fprintf(shout, "%s is on many keys", zlecmds[func].name); else { fprintf(shout, "%s is", zlecmds[func].name); --- 1107,1120 ---- { int i; ! if ((func = executenamedcommand("Where is: ")) == -1) return; funcfound = 0; trashzle(); clearflag = (isset(USEZLE) && termok && (isset(ALWAYSLASTPROMPT) && mult == 1)) || (unset(ALWAYSLASTPROMPT) && mult != 1); ! if (func == z_selfinsert || func == z_undefinedkey) fprintf(shout, "%s is on many keys", zlecmds[func].name); else { fprintf(shout, "%s is", zlecmds[func].name); *** 1.9 1995/07/23 04:21:39 --- Src/zle_misc.c 1995/07/23 17:34:35 *************** *** 580,586 **** if ((cmd = getkeycmd()) < 0 || cmd == z_sendbreak) { statusline = NULL; bindtab = obindtab; ! return z_undefinedkey; } switch (cmd) { case z_sendstring: --- 580,586 ---- if ((cmd = getkeycmd()) < 0 || cmd == z_sendbreak) { statusline = NULL; bindtab = obindtab; ! return -1; } switch (cmd) { case z_sendstring: *************** *** 631,637 **** if (!strcmp(buf, zlecmds[t0].name)) break; if (t0 != ZLECMDCOUNT) { - lastnamed = t0; statusline = NULL; bindtab = obindtab; return t0; --- 631,636 ---- *** 1.3 1995/07/22 18:39:21 --- Src/zle_move.c 1995/07/23 17:42:24 *************** *** 257,267 **** vibackwardchar(); return; } ! if (cs == lim) { feep(); return; } ! while (mult-- && cs != lim) cs++; } --- 257,267 ---- vibackwardchar(); return; } ! if (cs >= lim) { feep(); return; } ! while (mult-- && cs < lim) cs++; } -----BEGIN PGP SIGNATURE----- Version: 2.6.i iQBVAgUBMBKLnWWJ8JfKi+e9AQEyrQIAtutyoos5d62Zs6gLbMydoEsfScH30Wyj uKVs+/hrz1nqfJPmtV2jVwxX/Wlsxzx411Q6oaXjQm7ptYugFuS0ew== =HdB9 -----END PGP SIGNATURE-----