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",
|
name: "alignCursors",
|
||||||
exec: function(editor) { editor.alignCursors(); },
|
exec: function(editor) { editor.alignCursors(); },
|
||||||
bindKey: {win: "Ctrl-Alt-A", mac: "Ctrl-Alt-A"}
|
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
|
// commands active only in multiselect mode
|
||||||
|
|
|
||||||
|
|
@ -578,6 +578,12 @@ var Editor = require("./editor").Editor;
|
||||||
this.findAll = function(needle, options, additive) {
|
this.findAll = function(needle, options, additive) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
options.needle = needle || options.needle;
|
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);
|
this.$search.set(options);
|
||||||
|
|
||||||
var ranges = this.$search.findAll(this.session);
|
var ranges = this.$search.findAll(this.session);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue