replace all should not change the selection
This commit is contained in:
parent
635c5d05d5
commit
7206c60dc6
1 changed files with 5 additions and 2 deletions
|
|
@ -1016,13 +1016,16 @@ var Editor =function(renderer, session) {
|
||||||
if (!ranges.length)
|
if (!ranges.length)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
var selection = this.getSelectionRange();
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
this.selection.moveCursorTo(0, 0);
|
this.selection.moveCursorTo(0, 0);
|
||||||
|
|
||||||
|
this.$blockScrolling += 1;
|
||||||
for (var i = ranges.length - 1; i >= 0; --i)
|
for (var i = ranges.length - 1; i >= 0; --i)
|
||||||
this.$tryReplace(ranges[i], replacement);
|
this.$tryReplace(ranges[i], replacement);
|
||||||
if (ranges[0] !== null)
|
this.$blockScrolling -= 1;
|
||||||
this.selection.setSelectionRange(ranges[0]);
|
|
||||||
|
this.selection.setSelectionRange(selection);
|
||||||
},
|
},
|
||||||
|
|
||||||
this.$tryReplace = function(range, replacement) {
|
this.$tryReplace = function(range, replacement) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue