From e356ea8cae28d3ce64dfe9c29b5f97526e9ef1ca Mon Sep 17 00:00:00 2001 From: Julian Viereck Date: Thu, 28 Apr 2011 18:32:49 +0200 Subject: [PATCH] Ensure selection can't be inside of a fold. --- lib/ace/selection.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/ace/selection.js b/lib/ace/selection.js index 3e86a210..e9d1d12b 100644 --- a/lib/ace/selection.js +++ b/lib/ace/selection.js @@ -443,6 +443,12 @@ var Selection = function(session) { }; this.moveCursorTo = function(row, column, preventUpdateDesiredColumn) { + // Ensure the row/column is not inside of a fold. + var fold = this.session.getFoldAt(row, column, 1); + if (fold) { + row = fold.start.row; + column = fold.start.column; + } this.selectionLead.setPosition(row, column); if (!preventUpdateDesiredColumn) this.$updateDesiredColumn(this.selectionLead.column);