This commit is contained in:
Joe Walker 2010-11-26 17:09:26 +00:00
commit 8f0d0a555f
22 changed files with 570 additions and 497 deletions

View file

@ -427,7 +427,7 @@ var Editor =function(renderer, doc) {
var shouldOutdent = _self.mode.checkOutdent(lineState, _self.doc.getLine(cursor.row), text);
var line = _self.doc.getLine(cursor.row),
lineIndent = _self.mode.getNextLineIndent(lineState, line, _self.doc.getTabString());
var end = _self.doc.insert(cursor, text);
var end = _self.doc.insert(cursor, text);
/* TODO: This shortcut is somehow broken
if (!shouldOutdent && line != _self.doc.getLine(row) && text != "\n") {
@ -457,6 +457,7 @@ var Editor =function(renderer, doc) {
if (/[^\s]$/.test(line))
minIndent = Math.min(indent, minIndent);
}
for (var row = cursor.row + 1; row <= end.row; ++row) {
var outdent = minIndent;
@ -602,19 +603,22 @@ var Editor =function(renderer, doc) {
if (this.$readOnly)
return;
var range = this.getSelectionRange();
var doc = this.doc,
range = this.getSelectionRange();
if (range.start.row < range.end.row ||
range.start.column < range.end.column) {
var count = this.doc.indentRows(this.getSelectionRange(), "\t");
var count = doc.indentRows(this.getSelectionRange(), "\t");
this.selection.shiftSelection(count);
} else {
var indentString;
if (this.doc.getUseSoftTabs()) {
var size = this.doc.getTabSize(),
count = (size - this.getCursorPosition().column % size);
var size = doc.getTabSize(),
position = this.getCursorPosition(),
column = doc.documentToScreenColumn(position.row, position.column),
count = (size - column % size);
indentString = lang.stringRepeat(" ", count);
} else
@ -623,7 +627,7 @@ var Editor =function(renderer, doc) {
}
};
this.blockOutdent = function(indentString) {
this.blockOutdent = function() {
if (this.$readOnly)
return;
@ -956,13 +960,14 @@ var Editor =function(renderer, doc) {
if (options) {
this.$search.set(options);
}
this.clearSelection();
this.selection.moveCursorTo(0, 0);
var ranges = this.$search.findAll(this.doc);
if (!ranges.length)
return;
this.clearSelection();
this.selection.moveCursorTo(0, 0);
for (var i = ranges.length - 1; i >= 0; --i)
this.$tryReplace(ranges[i], replacement);
if (ranges[0] !== null)