From 78d2e48ab257e3567234cb554857fafb25b7860c Mon Sep 17 00:00:00 2001 From: Fabian Jakobs Date: Tue, 13 Dec 2011 14:04:57 +0100 Subject: [PATCH] when setting fold style to manual unfold all folds --- lib/ace/edit_session/folding.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/ace/edit_session/folding.js b/lib/ace/edit_session/folding.js index a1d9be3f..1a3ffa5f 100644 --- a/lib/ace/edit_session/folding.js +++ b/lib/ace/edit_session/folding.js @@ -467,8 +467,8 @@ function Folding() { this.getRowFoldEnd = function(docRow, startFoldRow) { var foldLine = this.getFoldLine(docRow, startFoldRow); return (foldLine - ? foldLine.end.row - : docRow) + ? foldLine.end.row + : docRow); }; this.getFoldDisplayLine = function(foldLine, endRow, endColumn, startRow, startColumn) { @@ -486,7 +486,7 @@ function Folding() { var doc = this.doc; var textLine = ""; - foldLine.walk(function(placeholder, row, column, lastColumn, isNewRow) { + foldLine.walk(function(placeholder, row, column, lastColumn) { if (row < startRow) { return; } else if (row == startRow) { @@ -532,11 +532,12 @@ function Folding() { this.toggleFold = function(tryToUnfold) { var selection = this.selection; var range = selection.getRange(); + var fold; + var bracketPos; if (range.isEmpty()) { var cursor = range.start; - var fold = this.getFoldAt(cursor.row, cursor.column); - var bracketPos; + fold = this.getFoldAt(cursor.row, cursor.column); if (fold) { this.expandFold(fold); @@ -654,6 +655,9 @@ function Folding() { this.$foldStyle = style; + if (style == "manual") + this.unfold(); + // reset folding var mode = this.$foldMode; this.$setFolding(null);