zsh-workers
 help / color / mirror / code / Atom feed
* Patch for spell-word with completeinword
@ 1996-11-19 19:06 Bart Schaefer
  0 siblings, 0 replies; only message in thread
From: Bart Schaefer @ 1996-11-19 19:06 UTC (permalink / raw)
  To: zsh-workers; +Cc: Matthew Braun

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1996-11-19 19:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-11-19 19:06 Patch for spell-word with completeinword Bart Schaefer

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).