rizonesoft / Notepad3

Notepad like text editor based on the Scintilla source code. Notepad3 based on code from Notepad2 and MiniPath on code from metapath. Download Notepad3:
https://www.rizonesoft.com/downloads/notepad3/
Other
5.01k stars 333 forks source link

Enhancement for Find/Replace dialog #170

Closed RaiKoHoff closed 6 years ago

RaiKoHoff commented 6 years ago

Starting from NP2-mod request (https://github.com/XhmikosR/notepad2-mod/issues/168), i would like to enhance the Find/Replace dialog a little bit.

On the beta channel, you will find a version (2.17.1111.665), which has these enhancements:

The find text box now has a green/red background indicator, which indicates whether the search string can be found in the document (green) or not (red). It will help to build regular expressions for searching text.

Cause the indication is updated just-in-time of typing text into the search box, this may slow down the response time of the dialog ...

If "Mark Occurrences" is active, all findings are marked within the text too O_o Warning: this may slow down the response time again ... :-/ The Find/Replace dialog is executed in parallel to the NP3 main window, so "Mark Occurrences" view menu must be disabled during Find/Replace time. (The Occ counter in the status bar will show the number of occurrences)

I would appreciate some feedback.

RaiKoHoff commented 6 years ago

On the beta channel, you will find a version (2.17.1111.667 - skipping the number of the devil ;-)), which has a system menu entry to toggle the new feature on/off.

lhmouse commented 6 years ago

hmmm if regex search is enabled and the user has input an invalid regex such as aa(bb then clicks Find, Notepad3 now says 'the specified text was not found`. Shouldn't this be 'Your regular expression is invalid' ?

RaiKoHoff commented 6 years ago

@lhmouse : you are right, but the DeelX engine is "fault tolerant to any error". See discussion here: https://github.com/sswater/deelx/issues/1 Unfortunately this is not what I like ... hmmm, I couldn't dig very deep into the regex engine to fix this :-/

lhmouse commented 6 years ago

looks like the author has opted not to fix it either. o_O pity.

RaiKoHoff commented 6 years ago

@lhmouse : yes, pity. I am looking for an alternate regex engine, but they are not as lean as DeelX o_O...

Maybe (?):

TRE is a lightweight, robust, and efficient POSIX compliant regexp matching library with some exciting features such as approximate (fuzzy) matching (https://github.com/laurikari/tre/)

lhmouse commented 6 years ago

perl regex ? it might be GPL'd however.

lhmouse commented 6 years ago

That could be an option. IMO a satisfactory regex library should base on specification of extended regex in POSIX, where (, ), {, } have their special meaning unless escaped, in opposition to those in basic regex. Other than that, I have no opinion on it.