Fixed single replace and removed several spurious
log messages.
This commit is contained in:
parent
04b4a59a81
commit
5d9f8cf0e9
1 changed files with 11 additions and 18 deletions
|
|
@ -414,7 +414,6 @@ var Editor = function(renderer, doc) {
|
|||
var size = _self.doc.getTabSize(),
|
||||
minIndent = Number.MAX_VALUE;
|
||||
|
||||
console.log("line indent " + lineIndent.length);
|
||||
for (var row = cursor.row + 1; row <= end.row; ++row) {
|
||||
var indent = 0;
|
||||
|
||||
|
|
@ -426,11 +425,9 @@ var Editor = function(renderer, doc) {
|
|||
indent += 1;
|
||||
else
|
||||
break;
|
||||
console.log("Indent " + indent + "(" + line.length + ")");
|
||||
if (/[^\s]$/.test(line))
|
||||
minIndent = Math.min(indent, minIndent);
|
||||
}
|
||||
console.log("min indent " + minIndent);
|
||||
for (var row = cursor.row + 1; row <= end.row; ++row) {
|
||||
var outdent = minIndent;
|
||||
|
||||
|
|
@ -440,8 +437,6 @@ var Editor = function(renderer, doc) {
|
|||
outdent -= size;
|
||||
else if (line.charAt(i) == ' ')
|
||||
outdent -= 1;
|
||||
console.log("from '" + line);
|
||||
console.log("to '" + line.substr(i));
|
||||
_self.doc.replace(new Range(row, 0, row, line.length), line.substr(i));
|
||||
}
|
||||
end.column += _self.doc.indentRows(
|
||||
|
|
@ -766,8 +761,6 @@ var Editor = function(renderer, doc) {
|
|||
};
|
||||
|
||||
this.gotoPageDown = function() {
|
||||
console.log("Goto page down");
|
||||
|
||||
var row = this.getPageDownRow(),
|
||||
column = Math.min(this.getCursorPosition().column,
|
||||
this.doc.getLine(row).length);
|
||||
|
|
@ -777,8 +770,6 @@ var Editor = function(renderer, doc) {
|
|||
};
|
||||
|
||||
this.gotoPageUp = function() {
|
||||
console.log("Goto page up");
|
||||
|
||||
var row = this.getPageUpRow(),
|
||||
column = Math.min(this.getCursorPosition().column,
|
||||
this.doc.getLine(row).length);
|
||||
|
|
@ -922,20 +913,21 @@ var Editor = function(renderer, doc) {
|
|||
};
|
||||
|
||||
this.replace = function(replacement, options) {
|
||||
if (options)
|
||||
this.$search.set(options);
|
||||
var range = this.$tryReplace(this.getSelectionRange(), replacement);
|
||||
if (range !== null)
|
||||
this.selection.setSelectionRange(range);
|
||||
this.$updateDesiredColumn();
|
||||
console.log("replacing with " + replacement);
|
||||
if (options)
|
||||
this.$search.set(options);
|
||||
|
||||
var range = this.$search.find(this.doc);
|
||||
this.$tryReplace(range, replacement);
|
||||
if (range !== null)
|
||||
this.selection.setSelectionRange(range);
|
||||
this.$updateDesiredColumn();
|
||||
},
|
||||
|
||||
this.replaceAll = function(replacement, options) {
|
||||
if (options) {
|
||||
console.log("Find " + options.needle);
|
||||
this.$search.set(options);
|
||||
}
|
||||
console.log("Replace " + replacement);
|
||||
this.clearSelection();
|
||||
this.selection.moveCursorTo(0, 0);
|
||||
|
||||
|
|
@ -945,7 +937,8 @@ var Editor = function(renderer, doc) {
|
|||
|
||||
for (var i = ranges.length - 1; i >= 0; --i)
|
||||
this.$tryReplace(ranges[i], replacement);
|
||||
this.selection.setSelectionRange(ranges[0]);
|
||||
if (ranges[0] !== null)
|
||||
this.selection.setSelectionRange(ranges[0]);
|
||||
this.$updateDesiredColumn();
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue