Skip to content

Commit c4390fb

Browse files
committed
[search addon] Reset search position when starting a new persistent search
Closes codemirror#3920
1 parent ea6382a commit c4390fb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

addon/search/search.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,10 @@
121121
persistentDialog(cm, queryDialog, q, function(query, event) {
122122
CodeMirror.e_stop(event);
123123
if (!query) return;
124-
if (query != state.queryText) startSearch(cm, state, query);
124+
if (query != state.queryText) {
125+
startSearch(cm, state, query);
126+
state.posFrom = state.posTo = cm.getCursor();
127+
}
125128
if (hiding) hiding.style.opacity = 1
126129
findNext(cm, event.shiftKey, function(_, to) {
127130
var dialog

0 commit comments

Comments
 (0)