Skip to content

Commit cee85b4

Browse files
committed
Fixed replace bugs
1 parent b1dd908 commit cee85b4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

client/utils/codemirror-search.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ function persistentDialog(cm, text, deflt, onEnter, replaceOpened, onKeyDown) {
8282
var state = getSearchState(cm);
8383

8484
CodeMirror.on(searchField, "keyup", function (e) {
85+
state.replaceStarted = false;
8586
if (e.keyCode !== 13 && searchField.value.length > 1) { // not enter and more than 1 character to search
8687
startSearch(cm, getSearchState(cm), searchField.value);
8788
} else if (searchField.value.length < 1) {
@@ -249,6 +250,9 @@ function persistentDialog(cm, text, deflt, onEnter, replaceOpened, onKeyDown) {
249250
var state = getSearchState(cm);
250251
var query = parseQuery(searchField.value, state);
251252
var withText = parseString(replaceField.value);
253+
if (searchField.value.length > 1) {
254+
state.replaceStarted = true;
255+
}
252256
if (state.replaceStarted) {
253257
replaceAll(cm, query, withText);
254258
state.replaceStarted = false;

0 commit comments

Comments
 (0)