RickStrahl / MarkdownMonster

An extensible Markdown Editor, Viewer and Weblog Publisher for Windows
https://markdownmonster.west-wind.com
Other
1.59k stars 235 forks source link

Find and Replace not working as expected using regex pattern #1148

Closed pa-0 closed 4 days ago

pa-0 commented 2 weeks ago

Specifically, I've noticed that when running a search that includes a newline character (\n), the Find box displays the number of found results (> 0), but the controls turn red and are disabled (see before and after pictures below):

Before newline character is included in search:

image

After inputting newline character:

image

RickStrahl commented 1 week ago

Hmmm... looks like a bug in ACE editor. Will take a look and see if I can fix this on my end.

Looks also like any \ will trigger this - in regEx mode or not which is a weird bug and surprising this hasn't come up before.

It's time to update ACE again too , so maybe that'll happen first to see if that's fixed in an update.

RickStrahl commented 1 week ago

Hmmm... interesting: Happening in the stock ACE implementation as well:

https://ace.c9.io/build/kitchen-sink.html

RickStrahl commented 1 week ago

Did a little more research on this and it looks like ACE does not support multi-line RegEx parsing. So anything that deals with \n is not going to work without major workarounds.

Since MM uses ACE there's not really a workaround.

Best I can offer here is to jump into VS Code and try to do the S&R there (right click Open -> Open In VS Code (if installed)) or you can configure another text editor if you're using something else you can save there and changes will update the active MM document if there are no changes so it's fairly transparent).

Not a great solution obviously but this is not something that can be fixed in the editor itself.

pa-0 commented 5 days ago

Maybe a context menu option for grepWin^1 (open source and much muuuch lighter than Vs Code -- native win32 app)?

pa-0 commented 5 days ago

As a plus, grepWin supports running regex replace at the directory level as well

RickStrahl commented 4 days ago

You can add any external program you want to Markdown Monster and it'll show up on the Open.. menu.

Configure and Run External Programs via Open With...

VS Code (if installed) is automatically added to the context menu since it's the most widely used generic code/text editor these days. But you can add whatever you want and also remove VS code if you don't want it to show up.