| 472 | } |
| 473 | |
| 474 | void DocumentView::foldRegion( Int64 foldDocIdx ) { |
| 475 | auto foldRegion = mDoc->getFoldRangeService().find( foldDocIdx ); |
| 476 | if ( !foldRegion ) |
| 477 | return; |
| 478 | if ( isOneToOne() || mDocLineToVisibleIndex.empty() || mVisibleLines.empty() || |
| 479 | mVisibleLinesOffset.empty() ) |
| 480 | invalidateCache(); |
| 481 | Int64 toDocIdx = foldRegion->end().line(); |
| 482 | changeVisibility( foldDocIdx + 1, toDocIdx, false ); |
| 483 | mFoldedRegions.push_back( *foldRegion ); |
| 484 | std::sort( mFoldedRegions.begin(), mFoldedRegions.end() ); |
| 485 | moveCursorToVisibleArea(); |
| 486 | verifyStructuralConsistency(); |
| 487 | } |
| 488 | |
| 489 | void DocumentView::unfoldRegion( Int64 foldDocIdx ) { |
| 490 | return unfoldRegion( foldDocIdx, true ); |