diff --git a/lib/ace/selection.js b/lib/ace/selection.js index 65e0fec5..5d315a25 100644 --- a/lib/ace/selection.js +++ b/lib/ace/selection.js @@ -440,7 +440,14 @@ var Selection = function(session) { this.selectionLead.row, this.selectionLead.column ); - var screenCol = (chars == 0 && this.$desiredColumn) || screenPos.column; + + var screenCol = (chars === 0 && this.$desiredColumn) || screenPos.column; + + if (this.$lines[screenPos.row].length === screenPos.column && + this.$lines[screenPos.row + rows].match(/^\s*$/)) { + screenCol = this.$lines[screenPos.row + rows].length; + } + var docPos = this.session.screenToDocumentPosition(screenPos.row + rows, screenCol); this.moveCursorTo(docPos.row, docPos.column + chars, chars == 0); };