File tree Expand file tree Collapse file tree 1 file changed +29
-4
lines changed
Expand file tree Collapse file tree 1 file changed +29
-4
lines changed Original file line number Diff line number Diff line change @@ -41,13 +41,38 @@ function FoldManager(Editor, FoldPointFinder) {
4141 return current ;
4242 }
4343
44+ /*
45+ ** Beneath first search for the fold that has the same start
46+ */
47+ function scan ( current , start ) {
48+ var result = null ;
49+ var node , fold ;
50+
51+ if ( current . start === start ) {
52+ return current ;
53+ }
54+
55+ if ( angular . isObject ( current . subFolds ) ) {
56+ for ( var k in current . subFolds ) {
57+ if ( angular . isObject ( current . subFolds ) ) {
58+ node = current . subFolds [ k ] ;
59+ fold = scan ( node , start ) ;
60+ if ( fold ) {
61+ result = fold ;
62+ }
63+ }
64+ }
65+ }
66+
67+ return result ;
68+ }
69+
4470 Editor . onFoldChanged ( function ( change ) {
45- var key = Editor . getLine ( change . data . start . row ) . trim ( ) . replace ( ':' , '' ) ;
71+ var row = change . data . start . row ;
4672 var folded = change . action !== 'remove' ;
73+ var fold = scan ( buffer , row ) ;
4774
48- if ( buffer [ key ] ) {
49- buffer [ key ] . folded = folded ;
50- }
75+ fold . folded = folded ;
5176
5277 emitChanges ( ) ;
5378 } ) ;
You can’t perform that action at this time.
0 commit comments