Added new line and tab as replacement in case of regex search#11614
Added new line and tab as replacement in case of regex search#11614ficristo wants to merge 1 commit intoadobe:masterfrom
Conversation
|
I found on the Notepadd++ repo this file https://github.com/notepad-plus-plus/notepad-plus-plus/blob/35adb1910ba98897ad3a935fa7d712a986289bd3/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp#L53 |
|
any news about this? |
|
👍 please merge. I ran across this problem multiple times already. |
|
I'm also waiting on this to be merged. |
|
Thanks @ficristo for this change. can you add unit test cases for this? |
There was a problem hiding this comment.
@ficristo This is an awesome improvement!
I think the name parseString() is too generic, though. Maybe regexUnescapeString() ?
Does this need to detect when the backslash itself escaped so that you can (for example) use "\n" to insert "\n" (i.e. not a newline)? Either way, that would be a good unit test.
There was a problem hiding this comment.
While I agree it is a bit generic, I prefer to preserve the name because it matches the one in CodeMirror. But it is not a big deal to change it if you really want.
To insert the chars \ and n in regex mode you need to escape it: \\n.
I'll look at adding some tests.
eec84b8 to
87c2d6b
Compare
|
10 find replace |
|
@abose The failing tests are failing in master too. |
87c2d6b to
2175a16
Compare
|
Now with tests. I still have some trouble with |
2175a16 to
eaa8a6b
Compare
|
@ficristo Are all the cases considered? We could omit the fixes for unit tests that were already failing before this PR. Are there any changes pending for merging this PR? |
|
@abose I still don't know how to test runs(function () {
myDocument.replaceRange(defaultContent.replace(/\n/g, "\r\n"), {line: 0, ch: 0});
myEditor.centerOnCursor = jasmine.createSpy("centering");
});Plus I just saw the |
eaa8a6b to
c1e549d
Compare
|
I think I've solved the |
c1e549d to
fcd84d4
Compare
fcd84d4 to
2301c87
Compare
|
Mode to 1.9 because, after all, I think having #10346 first would be better. |
|
Since this introduce a way to change the line endings I thought it was better to have something like #13152 first. |
|
I am also in favour in merging #13152, I have tested it myself and code also looks good to me, and I guess the problems mentioned in it(like loosing undo for line endings etc) can be ignored for now. |
This should fix #11611.
The idea comes from codemirror/codemirror5#3456 since Brackets do not use the search addon.