Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
addresses #11356 collapsing and expanding fold ranges in xml or html …
Browse files Browse the repository at this point in the history
…elements where the starttag spans more than one line now works correctly.
  • Loading branch information
thehogfather committed Jul 9, 2015
1 parent 2501136 commit cbc5190
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/extensions/default/CodeFolding/foldhelpers/foldcode.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ define(function (require, exports, module) {
});

textRange.on("clear", function (from, to) {
delete cm._lineFolds[from.line];
CodeMirror.signal(cm, "unfold", cm, from, to);
delete cm._lineFolds[pos.line];
CodeMirror.signal(cm, "unfold", cm, from, to, pos.line);
});

if (force === "fold") {
Expand All @@ -101,7 +101,7 @@ define(function (require, exports, module) {
delete cm._lineFolds[pos.line];
}

CodeMirror.signal(cm, force, cm, range.from, range.to);
CodeMirror.signal(cm, force, cm, range.from, range.to, pos.line);
return range;
}

Expand Down
12 changes: 8 additions & 4 deletions src/extensions/default/CodeFolding/foldhelpers/foldgutter.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,11 @@ define(function (require, exports, module) {
* @param {!CodeMirror} cm the CodeMirror instance for the active editor
* @param {!Object} from the ch and line position that designates the start of the region
* @param {!Object} to the ch and line position that designates the end of the region
* @param {?Number} gutterLineNumber the gutter line number that was clicked to signal the fold event
*/
function onFold(cm, from, to) {
var state = cm.state.foldGutter, line = from.line;
function onFold(cm, from, to, gutterLineNumber) {
var state = cm.state.foldGutter,
line = isNaN(gutterLineNumber) ? from.line : gutterLineNumber;
if (line >= state.from && line < state.to) {
updateFoldInfo(cm, line, line + 1);
}
Expand All @@ -335,9 +337,11 @@ define(function (require, exports, module) {
* @param {!CodeMirror} cm the CodeMirror instance for the active editor
* @param {!{line:number, ch:number}} from the ch and line position that designates the start of the region
* @param {!{line:number, ch:number}} to the ch and line position that designates the end of the region
* @param {?Number} gutterLineNumber the gutter line number that was clicked to signal the fold event
*/
function onUnFold(cm, from, to) {
var state = cm.state.foldGutter, line = from.line;
function onUnFold(cm, from, to, gutterLineNumber) {
var state = cm.state.foldGutter,
line = isNaN(gutterLineNumber) ? from.line : gutterLineNumber;
var vp = cm.getViewport();
if (line >= state.from && line < state.to) {
updateFoldInfo(cm, line, Math.min(vp.to, to.line));
Expand Down

0 comments on commit cbc5190

Please sign in to comment.