Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Patch for spell-word with completeinword



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@xxxxxxxxxx */
! 	    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



Messages sorted by: Reverse Date, Date, Thread, Author