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);