zufuliu / notepad4

Notepad4 (Notepad2⨯2, Notepad2++) is a light-weight Scintilla based text editor for Windows with syntax highlighting, code folding, auto-completion and API list for many programming languages and documents, bundled with file browser plugin matepath.
Other
2.42k stars 174 forks source link

Ctrl-F3 finds only using the part of the selection to the line end #805

Closed meteorquake closed 3 days ago

meteorquake commented 2 weeks ago

If you highlight an area spanning more than one line and do Ctrl-F and hit enter, it will find the next occurrance of your highlight.

But if you instead do Ctrl-F3, it will only use the portion of the highlight up to the linefeed for its finding.

I'm sure it would be best to act using the entire highlight just as Ctrl-F is able.

Cheers, David

Notepad2 (64-bit) 4.24.05 r5242 (8a997c12) Compiled on May 19 2024 with Visual C++ 19.39.33523.0, Scintilla 5.5.0. Encoding: UTF-8, Windows-1252 Scheme: , Text File System: 10.0.19045 x64

zufuliu commented 2 weeks ago

Caused by https://github.com/zufuliu/notepad4/blob/57436b1dbc198419f8543d510c91658596e46af4/src/Notepad4.cpp#L4748-L4752

zufuliu commented 2 weeks ago

Restriction for multiline selection removed by 2309bc4ab7f92b66c862f48f1da65f7476fa666e.

meteorquake commented 2 weeks ago

One thing I suppose could be done is to check the selection size - if it's rather excessive in size maybe it was invoked by accident and the user could be prompted or no action taken.

zufuliu commented 2 weeks ago

Yes, it has 2KB limit on selection size: https://github.com/zufuliu/notepad4/blob/2309bc4ab7f92b66c862f48f1da65f7476fa666e/src/Notepad4.cpp#L4742-L4743

https://github.com/zufuliu/notepad4/blob/2309bc4ab7f92b66c862f48f1da65f7476fa666e/src/Edit.h#L25-L27

meteorquake commented 2 weeks ago

Cheers! 2 Kb sounds reasonable. I'll mention if I find a scenario that needs more but I wouldn't envisage it.