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

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