WordHighlight icon indicating copy to clipboard operation
WordHighlight copied to clipboard

case_sensitive: false is ignored on files larger than file_size_limit (view.find() is called without the flag)

Open dpc00 opened this issue 2 months ago • 1 comments

"case_sensitive": false is ignored for files larger than file_size_limit: only exact-case matches are highlighted there (the workaround suggested in #86 works only for small files).

find_regions passes the case flag in the normal path but not in the size-limited path:

if not limited_size:
    regions += view.find_all(search, Pref.case_sensitive)         # flag passed
else:
    ...
    region = view.find(search, from_point)                        # <- no flags: always case-sensitive

Reproduced on Sublime Text build 4215 (Windows 11, portable copy, package from this repo's HEAD) with user settings {"case_sensitive": false, "file_size_limit": 20} and two scratch views, the first foo selected in each:

"foo Foo FOO\n"                                  (size 12, below the limit) -> highlights: foo, Foo, FOO
"foo Foo FOO x x x x x x x x x x x x\n" (size 36, above the limit) -> highlights: foo          <- Foo and FOO missing

(I called WordHighlightListener.highlight_occurences(view, forceUpdate=True) directly for both views so the result doesn't depend on event timing.)

Fix: pass the flag in the fallback search: view.find(search, from_point, Pref.case_sensitive).

Found while testing packages from the Package Control catalog.

dpc00 avatar Sep 26 '26 03:09 dpc00

Claude reports: closing this after 30 days with no response. Reopen it if it is still relevant.

dpc00 avatar Oct 27 '26 19:10 dpc00