From: Michael Elkins Date: Sat, 7 Apr 2007 22:08:44 +0000 (-0700) Subject: "complete" function should consider shell chars to be word boundaries when doing... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=124e7099a5da46f3e686f4a384cafce7581ebae2;p=neomutt "complete" function should consider shell chars to be word boundaries when doing filename completion (bug #2871) --- diff --git a/enter.c b/enter.c index 95f3989e4..9a1ac2d66 100644 --- 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 &&