From: Vincent Lefevre Date: Sun, 22 Jul 2018 00:57:32 +0000 (+0200) Subject: Improved limit-to-all detection by skipping leading spaces of the pattern. X-Git-Tag: mutt-1-11-rel~111 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1f3a9df87d1112d1e2d4e97fd00f02271df4e8cc;p=mutt Improved limit-to-all detection by skipping leading spaces of the pattern. There are many equivalent limit-to-all patterns, but in practice, one may want to limit to " ~A" in order to prevent the pattern from being recorded in the history. Thus it is important to detect at least this pattern and similar ones. --- diff --git a/pattern.c b/pattern.c index cfe4a700..c8bb1859 100644 --- a/pattern.c +++ b/pattern.c @@ -1532,6 +1532,8 @@ int mutt_pattern_func (int op, char *prompt) if (op == MUTT_LIMIT) { + char *pbuf; + /* drop previous limit pattern */ FREE (&Context->pattern); if (Context->limit_pattern) @@ -1541,7 +1543,10 @@ int mutt_pattern_func (int op, char *prompt) mutt_error _("No messages matched criteria."); /* record new limit pattern, unless match all */ - if (mutt_strcmp (buf, "~A") != 0) + pbuf = buf; + while (*pbuf == ' ') + pbuf++; + if (mutt_strcmp (pbuf, "~A") != 0) { Context->pattern = simple; simple = NULL; /* don't clobber it */