Notepad3 icon indicating copy to clipboard operation
Notepad3 copied to clipboard

Search Pattern display error with backslashes

Open sky1ab opened this issue 3 years ago • 4 comments

ctrl+h and ctrl+f show same behaviour:

extract portable zip to new folder, enable "show linebreaks" ctrl+shift+9 example text is a few lines of "fdasCRLF" cursor at document beginning, no text selected

  1. ctrl+h / search+replace -> search box is empty + blue
  2. "transform backslashes" enabled
  3. search for \n -> all LF are selected
  4. close dialog, move cursor to clear selection(s)
  5. open again ctrl+h / search + replace

result: "Search String:" appears empty but in green color, but in fact has \n selected, as all LF markers in document are selected again, "find next" is clickable and moves to next LF ...

expected result: "Search String:" contains a visible "\n" and is green, or is empty and blue and "find next" is disabled and gray

older v5.20.915.1 shows \n with green background color, new 5.21.905.1 and 5.21.1109.1_rc show empty box with green background color

sky1ab avatar Nov 10 '21 15:11 sky1ab

"Search String:" appears empty but in green color, but in fact has \n selected,

  • The end of line CRLF is normally hidden and stands for Carridge Return Line Feed
  • The end of line \r is normally hidden and stands for return or Carridge Return
  • The end of line \n is normally hidden stands for new line or Line Feed

Examples in a Multi-lines selection:

2021-11-14_092125

2021-11-14_092412

2021-11-14_092505

Transform backslashes is used to search on special characters:

2021-11-14_095832

hpwamr avatar Nov 14 '21 08:11 hpwamr

ok, thanks, i have to admit i never tried that new toggle thing.

i found it in the changelog: [.914.1]- F/R Dialog: toggle "Esc Ctrl Chr", try reverse operation if no length change [.913.1]- Bad design: F/R dialog: remove auto Esc Ctrl Chr (changed to manual explicit).

so i was confused by this behavior:

  1. "use last search string but hide control chars on dialog open",
  2. "show control chars when a search pattern is selected in the select-box list"

i'd like some .ini option to enable "always show control chars in f/r dialog" for the behavior 1) to avoid the confusion/extra click, or, show control chars when the search pattern consist solely of control chars

sky1ab avatar Nov 14 '21 11:11 sky1ab

@sky1ab : You are right, there are some inconsistencies in handling Esc Ctrl Chr-Toggle + Transform Backslashes + Save/Restore F/R-History .

RaiKoHoff avatar Nov 15 '21 16:11 RaiKoHoff

@hpwamr : No this one was not solved with latest PRs.

RaiKoHoff avatar Nov 15 '21 23:11 RaiKoHoff

jumped from v5.20.915.1 to v5.21.1129.1 and the above problem re-appeared: "search string" green background and empty with content \r\n "replace with" white background and visible content \r\n with "tranform backslashes" enabled

have to click the top "esc ctrl char" to see search text same on Notepad3_5.22.1213.1_rc2

sky1ab avatar Dec 18 '22 04:12 sky1ab

We missed a call of updating search results after pressing EscCtrlChr .

General: Background coloring (green(found), blue(missing), red(RegExpr error).

Example: Search pattern "\r\n" or invisible CR LF after pressing EscCtrlChr:

  • OK: "\r\n" only found (green) if "Transform backslashes" is active, sinde 4-byte sequence '\','r','\','n' is not part of the document.
  • OK: pressing EscCtrlChr, turns the sequence into invisible CR LF which will be found in document (all EOLs) -> green (it is still in the input box, Ctrl+A,Ctrl-C will copy it to clipboard, Ctrl-V can paste into document)
  • OK: invisible CR LF will still be found, independent of pressing "Transform backslashes" since there are no backslashes to transform.
  • OK: Replace Text Box will never get a green, blue or red background color - it is going to replace findings, not to search for.
  • OK: "Transform backslashes" also applies to Replace Text - either replace by 4-byte sequence '\','r','\','n' or by CR LF depending on checked or not.

Did I miss a case ?

RaiKoHoff avatar Jan 09 '23 17:01 RaiKoHoff

General: Background coloring (green(found), blue(missing), red(RegExpr error).

Hello @sky1ab ,

Feel free to test the "BETA/RC PortableApps", version "Notepad3Portable_5.23.109.1_rc2.paf" or newer, see in issue #1129.

"Notepad3Portable BETA/RC PortableApps" version can be used with or without ".7z" extension.

Also, feel free to test the "BETA/RC Setup", version "Notepad3_5.23.109.1_rc2_Setup" or newer, see the 2nd list in issue #1129.

Comments and suggestions are welcome... 😃

hpwamr avatar Jan 09 '23 22:01 hpwamr