Skip to content

Commit

Permalink
[search addon] Capture keys for search-related commands in persistent…
Browse files Browse the repository at this point in the history
… dialog
  • Loading branch information
40thieves authored and marijnh committed Jun 7, 2016
1 parent 8eb1588 commit 5c6025a
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion addon/search/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,21 @@
value: deflt,
selectValueOnOpen: true,
closeOnEnter: false,
onClose: function() { clearSearch(cm); }
onClose: function() { clearSearch(cm); },
onKeyDown: function(ev, query) {
var cmd = CodeMirror.keyMap['default'][CodeMirror.keyName(ev)];
if (cmd) {
var nextSearchCmds = ['findNext', 'findPrev'];
var searchCmds = ['find', 'findPersistent'];
if (nextSearchCmds.indexOf(cmd) !== -1) {
startSearch(cm, getSearchState(cm), query);
CodeMirror.commands[cmd](cm);
CodeMirror.e_stop(ev);
} else if (searchCmds.indexOf(cmd) !== -1) {
f(query, ev);
}
}
}
});
}

Expand Down

0 comments on commit 5c6025a

Please sign in to comment.