- Fixed replaceAll
This commit is contained in:
parent
f22fc5a2f5
commit
f6039ddab4
1 changed files with 8 additions and 7 deletions
|
|
@ -886,7 +886,7 @@ var Editor = function(renderer, doc) {
|
|||
};
|
||||
|
||||
this.replace = function(replacement, options) {
|
||||
if (options)
|
||||
if (options)
|
||||
this.$search.set(options);
|
||||
var range = this.$tryReplace(this.getSelectionRange(), replacement);
|
||||
if (range !== null)
|
||||
|
|
@ -895,8 +895,11 @@ var Editor = function(renderer, doc) {
|
|||
},
|
||||
|
||||
this.replaceAll = function(replacement, options) {
|
||||
if (options)
|
||||
if (options) {
|
||||
console.log("Find " + options.needle);
|
||||
this.$search.set(options);
|
||||
}
|
||||
console.log("Replace " + replacement);
|
||||
this.clearSelection();
|
||||
this.selection.moveCursorTo(0, 0);
|
||||
|
||||
|
|
@ -904,11 +907,9 @@ var Editor = function(renderer, doc) {
|
|||
if (!ranges.length)
|
||||
return;
|
||||
|
||||
for (var i=0; i<ranges.length; i++) {
|
||||
var range = ranges[i];
|
||||
this.$tryReplace(range, replacement);
|
||||
}
|
||||
this.selection.setSelectionRange(range);
|
||||
for (var i = ranges.length - 1; i >= 0; --i)
|
||||
this.$tryReplace(ranges[i], replacement);
|
||||
this.selection.setSelectionRange(ranges[0]);
|
||||
this.$updateDesiredColumn();
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue