From 144a4ef502353e03fba5a9e3799a041dfb5c18b6 Mon Sep 17 00:00:00 2001 From: Fabian Jakobs Date: Tue, 18 May 2010 17:27:41 +0200 Subject: [PATCH] removing tabs influences the cursor position --- src/ace/Editor.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ace/Editor.js b/src/ace/Editor.js index 088eb668..b6408992 100644 --- a/src/ace/Editor.js +++ b/src/ace/Editor.js @@ -170,6 +170,9 @@ ace.Editor = function(renderer, doc) { var data = e.data; this.bgTokenizer.start(data.firstRow); this.renderer.updateLines(data.firstRow, data.lastRow); + + // update cursor because tab characters can influence the cursor position + this.renderer.updateCursor(this.getCursorPosition(), this.$overwrite); }; this.onTokenizerUpdate = function(e) { @@ -341,6 +344,7 @@ ace.Editor = function(renderer, doc) { var cursor = this.getCursorPosition(); text = text.replace("\t", this.doc.getTabString()); + // remove selected text if (!this.selection.isEmpty()) { var cursor = this.doc.remove(this.getSelectionRange()); this.clearSelection();