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

Re: [PATCH?] Re: Autocorrect for commands with a hyphen (dash) in the name



> spckword() modifies the original input string in place, to return the
> best guess.  In both lex.c and zle_tricky.c, that result string is
> then used in later code, which means if it goes in tokenized it ought
> to come back out that way as well.

Maybe this is just the best way to deal with this mess.

diff --git a/Src/utils.c b/Src/utils.c
index 5158a70..118e132 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -3151,8 +3151,12 @@ spckword(char **s, int hist, int cmd, int ask)
     if (*t == Tilde || *t == Equals || *t == String)
     t++;
     for (; *t; t++)
-    if (itok(*t))
-        return;
+    if (itok(*t)) {
+        if (*t == Dash)
+        *t = '-';
+        else
+        return;
+    }
     best = NULL;
     for (t = *s; *t; t++)
     if (*t == '/')



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