* autocorrect: this *almost* works
@ 1996-11-14 11:07 Bart Schaefer
0 siblings, 0 replies; only message in thread
From: Bart Schaefer @ 1996-11-14 11:07 UTC (permalink / raw)
To: zsh-workers
Looking at docomplete(), it seems to me that we should be able to add the
tcsh autocorrect option pretty easily, by allowing spell checking to occur
and then falling through to the rest of the completion.
The following patch shows the skeleton for this change, but is NOT USABLE
as-is. After
inststr(*x);
in the second hunk, it's necessary at the least to add
s = *x; /* Is it OK to refer to *x beyond this point?? */
and then to restore the word-boundary and cursor-position globals before
the rest of the completion proceeds. Unfortunately, I'm not sufficiently
familiar with this mass of cryptic two-letter variable names to get it to
do the right thing. Anyone else care to try? Have I missed other things
that would make this unworkable?
Of course, this still doesn't address the utter failure of spckword() on
paths beginning with a named directory ....
Random extra thought: A variant of spckword() could return all the words
within a certain spdist() range of a given word. This could then be used
to construct a menu in docompletion(); and we could add a menu-spell-word
function (whose prefix-arg gives the distance range?), get autocorrect to
work properly in conjunction with menucomplete and automenu, etc.
--- Src/zle_tricky.c Thu Oct 24 03:01:48 1996
+++ Src/zle_tricky.c.new Thu Nov 14 02:20:22 1996
@@ -673,7 +673,7 @@
if (lincmd && (inwhat == IN_NOTHING))
inwhat = IN_CMD;
- if (lst == COMP_SPELL) {
+ if (lst == COMP_SPELL || isset(AUTOCORRECT)) {
char **x = &s;
char *q = s;
@@ -686,7 +686,8 @@
/* call the real spell checker, ash@aaii.oz.zu */
spckword(x, 0, lincmd, 0);
inststr(*x);
- } else if (COMP_ISEXPAND(lst)) {
+ }
+ if (COMP_ISEXPAND(lst)) {
/* Do expansion. */
char *ol = (olst == COMP_EXPAND_COMPLETE) ?
dupstring((char *)line) : (char *)line;
@@ -717,7 +718,7 @@
p++, skipparens(Inbrace, Outbrace, &p);
docompletion(s, lst, lincmd, 1);
}
- } else
+ } else if (lst != COMP_SPELL)
/* Just do completion. */
docompletion(s, lst, lincmd, 0);
zsfree(s);
--
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-14 11:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-11-14 11:07 autocorrect: this *almost* works 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).