add findall command
This commit is contained in:
parent
0a9dc16f22
commit
14721de01f
2 changed files with 12 additions and 1 deletions
|
|
@ -80,6 +80,11 @@ exports.defaultCommands = [{
|
|||
name: "alignCursors",
|
||||
exec: function(editor) { editor.alignCursors(); },
|
||||
bindKey: {win: "Ctrl-Alt-A", mac: "Ctrl-Alt-A"}
|
||||
}, {
|
||||
name: "findAll",
|
||||
exec: function(editor) { editor.findAll(); },
|
||||
bindKey: {win: "Ctrl-Alt-K", mac: "Ctrl-Alt-G"},
|
||||
readonly: true
|
||||
}];
|
||||
|
||||
// commands active only in multiselect mode
|
||||
|
|
|
|||
|
|
@ -578,8 +578,14 @@ var Editor = require("./editor").Editor;
|
|||
this.findAll = function(needle, options, additive) {
|
||||
options = options || {};
|
||||
options.needle = needle || options.needle;
|
||||
if (options.needle == undefined) {
|
||||
var range = this.selection.isEmpty()
|
||||
? this.selection.getWordRange()
|
||||
: this.selection.getRange();
|
||||
options.needle = this.session.getTextRange(range);
|
||||
}
|
||||
this.$search.set(options);
|
||||
|
||||
|
||||
var ranges = this.$search.findAll(this.session);
|
||||
if (!ranges.length)
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue