Skip to content

Commit 08ac1a4

Browse files
akoremanAlice Koreman
and
Alice Koreman
authored
add backwards multiline search test (#5751)
Co-authored-by: Alice Koreman <[email protected]>
1 parent 06d51b9 commit 08ac1a4

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/search_test.js

+18
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,24 @@ module.exports = {
679679
assert.position(ranges[7].end, 15, 0);
680680
},
681681

682+
"test: find line breaks backwards using regex" : function() {
683+
var session = new EditSession('\nfunction foo(items, nada) {\n for (var i=0; i<items.length; i++) {\n alert(items[i] + "juhu\\n");\n }\t/* Real Tab */\n\n\n\n\n}\n\n\n// test search/replace line break with regexp\r\n\r\n\t\t\t\t\n');
684+
session.getSelection().moveCursorTo(2, 5);
685+
686+
var search = new Search().set({
687+
needle: "\\n",
688+
regExp: true,
689+
wrap: true,
690+
backwards: true
691+
});
692+
693+
var range = search.find(session);
694+
695+
// Should find the first newline to the left of the cursor
696+
assert.position(range.start, 1, 27);
697+
assert.position(range.end, 2, 0);
698+
},
699+
682700
"test: replace with line breaks (\\n) and TAB (\\t) using regular expression" : function() {
683701
var search = new Search().set({
684702
needle: "with",

0 commit comments

Comments
 (0)