Fix "must contain" with too many of a letter

If the "must contain" (rs) set had too many uses of a character,
the initial letter counts (ww) could be nonsense.

Now, if you do a bogus search like `munmunii -- iii` (commandline)
or `munmun =iii` (web), you'll get 0 results. (it'll somewhat
confusingly report that it reached a max of 0 searches, but so
be it)

Closes #1
This commit is contained in:
Jeff Epler 2025-05-01 09:39:46 +02:00
parent a62195590d
commit ffe196d6aa

9
run.cc
View file

@ -350,7 +350,14 @@ struct ana_cfg {
: apos(apos), just_candidates(just_candidates), minlen(minlen), : apos(apos), just_candidates(just_candidates), minlen(minlen),
maxlen(maxlen), maxlen(maxlen),
total_matches(0), max_matches(max_matches), total_searches(0), total_matches(0), max_matches(max_matches), total_searches(0),
max_searches(max_searches), lengths(lengths), rs(rs), ww(wordholder(ws).value() - wordholder(rs).value()) { max_searches(max_searches), lengths(lengths), rs(rs), ww() {
auto wsv = wordholder(ws).value();
auto rsv = wordholder(rs).value();
if (candidate(wsv, rsv)) {
ww = wsv - rsv;
} else {
this->max_searches = 0;
}
} }
bool apos, just_candidates; bool apos, just_candidates;