Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit d5f3022

Browse files
author
Narciso Jaramillo
committed
Use state of case sensitivity toggle even when find bar isn't open
1 parent 70d3e5c commit d5f3022

2 files changed

Lines changed: 28 additions & 1 deletion

File tree

src/search/FindReplace.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ define(function (require, exports, module) {
100100

101101
function getSearchCursor(cm, query, pos) {
102102
// Heuristic: if the query string is all lowercase, do a case insensitive search.
103-
return cm.getSearchCursor(query, pos, !$("#find-case-sensitive").is(".active"));
103+
return cm.getSearchCursor(query, pos, !PreferencesManager.getViewState("caseSensitive"));
104104
}
105105

106106
function _updateSearchBarFromPrefs() {

test/spec/FindReplace-test.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,33 @@ define(function (require, exports, module) {
407407
});
408408
});
409409

410+
it("should Find Next after search bar closed, remembering case sensitivity state", function () {
411+
runs(function () {
412+
myEditor.setCursorPos(0, 0);
413+
414+
twCommandManager.execute(Commands.EDIT_FIND);
415+
416+
toggleCaseSensitive(true);
417+
enterSearchText("Foo");
418+
pressEscape();
419+
expectHighlightedMatches([]);
420+
});
421+
422+
waitsForSearchBarClose();
423+
424+
runs(function () {
425+
expectSelection(capitalFooSelections[0]);
426+
twCommandManager.execute(Commands.EDIT_FIND_NEXT);
427+
expectSelection(capitalFooSelections[1]);
428+
twCommandManager.execute(Commands.EDIT_FIND_NEXT);
429+
expectSelection(capitalFooSelections[2]);
430+
431+
// next find should wraparound since it should skip the lowercase "foo()"
432+
twCommandManager.execute(Commands.EDIT_FIND_NEXT);
433+
expectSelection(capitalFooSelections[0]);
434+
});
435+
});
436+
410437
it("shouldn't Find Next after search bar reopened", function () {
411438
runs(function () {
412439
myEditor.setCursorPos(0, 0);

0 commit comments

Comments
 (0)