MCPcopy Create free account
hub / github.com/ProgerXP/Notepad2e / FoldLine

Method FoldLine

scintilla/src/Editor.cxx:7124–7158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7122}
7123
7124void 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
7160void Editor::FoldExpand ( int line, int action, int level )
7161{

Callers

nothing calls this directly

Calls 9

GetFoldParentMethod · 0.80
GetLastChildMethod · 0.80
SetExpandedMethod · 0.80
SetVisibleMethod · 0.80
MainCaretMethod · 0.80
GetVisibleMethod · 0.80
GetLevelMethod · 0.45
GetExpandedMethod · 0.45
LineFromPositionMethod · 0.45

Tested by

no test coverage detected