fix(cli): search limit counts visible results, filter before cap

Pass 0 (unlimited) to m.Search so the mail layer returns all matching
headers; the existing post-filter loop already caps at the caller's
limit, mirroring ListCmd. Add TestSearchLimitCountsVisibleOnly to prove
filtering happens before the cap.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-22 00:17:39 +01:00
parent dd181ef63c
commit 6061bd2a78
2 changed files with 33 additions and 1 deletions
+1 -1
View File
@@ -187,7 +187,7 @@ func SearchCmd(d Deps, account, folder string, sc mail.SearchCriteria, limit int
return d.emit(*fail)
}
defer done()
headers, err := m.Search(folder, sc, limit)
headers, err := m.Search(folder, sc, 0)
if err != nil {
return d.emit(Failure(CodeNetwork, err.Error()))
}