]> granicus.if.org Git - neomutt/commitdiff
"complete" function should consider shell chars to be word boundaries when doing...
authorMichael Elkins <me@mutt.org>
Sat, 7 Apr 2007 22:08:44 +0000 (15:08 -0700)
committerMichael Elkins <me@mutt.org>
Sat, 7 Apr 2007 22:08:44 +0000 (15:08 -0700)
enter.c

diff --git a/enter.c b/enter.c
index 95f3989e4c976e1944c28956b5421a24690090df..9a1ac2d660d07c4af7dbe3904e1dafe2a2c7812b 100644 (file)
--- a/enter.c
+++ b/enter.c
@@ -186,6 +186,15 @@ static void replace_part (ENTER_STATE *state, size_t from, char *buf)
   FREE (&savebuf);
 }
 
+/*
+ * Return 1 if the character is not typically part of a pathname
+ */
+inline int is_shell_char(wchar_t ch)
+{
+  static wchar_t shell_chars[] = L"<>&()$?*;{} "; /* ! not included because it can be part of a pathname in Mutt */
+  return wcschr(shell_chars, ch) != NULL;
+}
+
 /*
  * Returns:
  *     1 need to redraw the screen and call me again
@@ -477,7 +486,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x,
          state->tabs++;
          if (flags & M_CMD)
          {
-           for (i = state->curpos; i && state->wbuf[i-1] != ' '; i--)
+           for (i = state->curpos; i && !is_shell_char(state->wbuf[i-1]); i--)
              ;
            my_wcstombs (buf, buflen, state->wbuf + i, state->curpos - i);
            if (tempbuf && templen == state->lastchar - i &&