| 7122 | } |
| 7123 | |
| 7124 | void Editor::FoldLine ( int line, int action ) |
| 7125 | { |
| 7126 | if ( line >= 0 ) { |
| 7127 | if ( action == SC_FOLDACTION_TOGGLE ) { |
| 7128 | if ( ( pdoc->GetLevel ( line ) & SC_FOLDLEVELHEADERFLAG ) == 0 ) { |
| 7129 | line = pdoc->GetFoldParent ( line ); |
| 7130 | if ( line < 0 ) { |
| 7131 | return; |
| 7132 | } |
| 7133 | } |
| 7134 | action = ( cs.GetExpanded ( line ) ) ? SC_FOLDACTION_CONTRACT : SC_FOLDACTION_EXPAND; |
| 7135 | } |
| 7136 | if ( action == SC_FOLDACTION_CONTRACT ) { |
| 7137 | int lineMaxSubord = pdoc->GetLastChild ( line ); |
| 7138 | if ( lineMaxSubord > line ) { |
| 7139 | cs.SetExpanded ( line, 0 ); |
| 7140 | cs.SetVisible ( line + 1, lineMaxSubord, false ); |
| 7141 | int lineCurrent = pdoc->LineFromPosition ( sel.MainCaret() ); |
| 7142 | if ( lineCurrent > line && lineCurrent <= lineMaxSubord ) { |
| 7143 | // This does not re-expand the fold |
| 7144 | EnsureCaretVisible(); |
| 7145 | } |
| 7146 | } |
| 7147 | } else { |
| 7148 | if ( ! ( cs.GetVisible ( line ) ) ) { |
| 7149 | EnsureLineVisible ( line, false ); |
| 7150 | GoToLine ( line ); |
| 7151 | } |
| 7152 | cs.SetExpanded ( line, 1 ); |
| 7153 | ExpandLine ( line ); |
| 7154 | } |
| 7155 | SetScrollBars(); |
| 7156 | Redraw(); |
| 7157 | } |
| 7158 | } |
| 7159 | |
| 7160 | void Editor::FoldExpand ( int line, int action, int level ) |
| 7161 | { |
nothing calls this directly
no test coverage detected