when setting fold style to manual unfold all folds

This commit is contained in:
Fabian Jakobs 2011-12-13 14:04:57 +01:00
commit 78d2e48ab2

View file

@ -468,7 +468,7 @@ function Folding() {
var foldLine = this.getFoldLine(docRow, startFoldRow); var foldLine = this.getFoldLine(docRow, startFoldRow);
return (foldLine return (foldLine
? foldLine.end.row ? foldLine.end.row
: docRow) : docRow);
}; };
this.getFoldDisplayLine = function(foldLine, endRow, endColumn, startRow, startColumn) { this.getFoldDisplayLine = function(foldLine, endRow, endColumn, startRow, startColumn) {
@ -486,7 +486,7 @@ function Folding() {
var doc = this.doc; var doc = this.doc;
var textLine = ""; var textLine = "";
foldLine.walk(function(placeholder, row, column, lastColumn, isNewRow) { foldLine.walk(function(placeholder, row, column, lastColumn) {
if (row < startRow) { if (row < startRow) {
return; return;
} else if (row == startRow) { } else if (row == startRow) {
@ -532,11 +532,12 @@ function Folding() {
this.toggleFold = function(tryToUnfold) { this.toggleFold = function(tryToUnfold) {
var selection = this.selection; var selection = this.selection;
var range = selection.getRange(); var range = selection.getRange();
var fold;
var bracketPos;
if (range.isEmpty()) { if (range.isEmpty()) {
var cursor = range.start; var cursor = range.start;
var fold = this.getFoldAt(cursor.row, cursor.column); fold = this.getFoldAt(cursor.row, cursor.column);
var bracketPos;
if (fold) { if (fold) {
this.expandFold(fold); this.expandFold(fold);
@ -654,6 +655,9 @@ function Folding() {
this.$foldStyle = style; this.$foldStyle = style;
if (style == "manual")
this.unfold();
// reset folding // reset folding
var mode = this.$foldMode; var mode = this.$foldMode;
this.$setFolding(null); this.$setFolding(null);