From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: zsh-workers-request@euclid.skiles.gatech.edu Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by coral.primenet.com.au (8.7.6/8.7.3) with ESMTP id GAA09004 for ; Wed, 20 Nov 1996 06:18:43 +1100 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id OAA03906; Tue, 19 Nov 1996 14:05:36 -0500 (EST) Resent-Date: Tue, 19 Nov 1996 14:05:36 -0500 (EST) From: "Bart Schaefer" Message-Id: <961119110644.ZM3836@candle.brasslantern.com> Date: Tue, 19 Nov 1996 11:06:44 -0800 Reply-To: schaefer@nbn.com X-Mailer: Z-Mail (4.0b.820 20aug96) To: zsh-workers@math.gatech.edu Subject: Patch for spell-word with completeinword Cc: Matthew Braun MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"mxHTS2.0.yy._JWao"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/2430 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu This patch makes spell-word "aware" of COMPLETE_IN_WORD; with that option set, it corrects spelling only in the prefix to the left of the cursor. This is useful independent of my previous spname() patch if spell-word is always invoked with the cursor on or immediately after a slash; with the previous patch it makes less difference where the cursor is. This patch *includes* my corrected version of Zoltan's patch for leading tildes in the corrected word, from 3.1.0-test3; the diff is against 3.0.1. *** Src/zle_tricky.c.0 Fri Nov 15 08:34:10 1996 --- Src/zle_tricky.c Tue Nov 19 10:57:52 1996 *************** *** 674,691 **** inwhat = IN_CMD; if (lst == COMP_SPELL) { ! char **x = &s; ! char *q = s; ! for (; *q; q++) if (INULL(*q)) *q = Nularg; - untokenize(s); cs = wb; ! foredel(we - wb); ! /* call the real spell checker, ash@aaii.oz.zu */ ! spckword(x, 0, lincmd, 0); ! inststr(*x); } else if (COMP_ISEXPAND(lst)) { /* Do expansion. */ char *ol = (olst == COMP_EXPAND_COMPLETE) ? --- 674,700 ---- inwhat = IN_CMD; if (lst == COMP_SPELL) { ! char *x, *q; ! for (q = s; *q; q++) if (INULL(*q)) *q = Nularg; cs = wb; ! if (unset(COMPLETEINWORD)) ! foredel(we - wb); ! else ! foredel(ocs - wb); ! HEAPALLOC { ! x = dupstring(s); ! if (isset(COMPLETEINWORD)) ! x[ocs-cs] = 0; ! untokenize(x); ! if (*s == Tilde || *s == Equals || *s == String) ! *x = *s; ! spckword(&x, 0, lincmd, 0); ! } LASTALLOC; ! untokenize(x); ! inststr(x); } else if (COMP_ISEXPAND(lst)) { /* Do expansion. */ char *ol = (olst == COMP_EXPAND_COMPLETE) ? -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.nbn.com/people/lantern