From 13d6c4cc78afbafbb26f213aa99bb8215e986837 Mon Sep 17 00:00:00 2001 From: Michael Elkins Date: Sat, 7 Apr 2007 15:08:44 -0700 Subject: [PATCH] "complete" function should consider shell chars to be word boundaries when doing filename completion (bug #2871) --- enter.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/enter.c b/enter.c index 95f3989e..9a1ac2d6 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 && -- 2.40.0