aboutsummaryrefslogtreecommitdiffstats
path: root/src/searchterm.h
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-01 10:31:51 +0200
committerDanilo M. <danix@danix.xyz>2026-10-01 10:31:51 +0200
commitb12aada52d682c45aa1e66e13dc448dc894aee79 (patch)
treee41ded20c908ee458e44171c6f4f7088ee613639 /src/searchterm.h
parent236ac86ca09a24300e724c2372f3576bf3f6ff84 (diff)
downloadqtmaildir-b12aada52d682c45aa1e66e13dc448dc894aee79.tar.gz
qtmaildir-b12aada52d682c45aa1e66e13dc448dc894aee79.zip
fix: double a quote in a search term, as notmuch expects
SearchTerm::quote() escaped an embedded double quote with a backslash. notmuch has no backslash escape inside a quoted term: it doubles the quote, and a backslash-escaped one ENDS the term. Selected text holding a quote therefore let the rest of the selection reach the query as syntax. Measured on a throwaway index: under a `tag:nomatch and` scope, the backslash form of `x " or tag:inbox or id:"` matched every message, while the doubled form matched none. quote() now doubles the quote and leaves a backslash alone, since notmuch reads it literally. Truncation still runs first, so a cut cannot split a doubled pair. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'src/searchterm.h')
-rw-r--r--src/searchterm.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/searchterm.h b/src/searchterm.h
index 3a0cac2..8ca67e4 100644
--- a/src/searchterm.h
+++ b/src/searchterm.h
@@ -59,8 +59,9 @@ enum class SearchMode {
/// Quotes an arbitrary value for use as a notmuch term.
///
/// Whitespace and newlines collapse to single spaces, embedded quotes are
-/// escaped, the value is capped at kMaxValueLength, and an empty or
-/// whitespace-only value yields an EMPTY STRING rather than `""`. Callers
+/// doubled (notmuch has no backslash escape), the value is capped at
+/// kMaxValueLength, and an empty or whitespace-only value yields an EMPTY
+/// STRING rather than `""`. Callers
/// test for empty to decide whether to offer a menu entry at all.
QString quote(const QString &value);