From 1f3a9df87d1112d1e2d4e97fd00f02271df4e8cc Mon Sep 17 00:00:00 2001 From: Vincent Lefevre Date: Sun, 22 Jul 2018 02:57:32 +0200 Subject: [PATCH] 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. --- pattern.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 */ -- 2.50.1