Updated toggle fold so it works if cursor isn't in head line (feature request 1824940).

This commit is contained in:
Gerald Schmidt 2007-11-25 22:56:21 +00:00
parent 55759f3a6d
commit 204d42124a
1 changed files with 19 additions and 2 deletions

View File

@ -1728,8 +1728,25 @@ void XmlCtrl::toggleFold()
return; return;
line = LineFromPosition ( pos ); line = LineFromPosition ( pos );
level = GetFoldLevel ( line ); level = GetFoldLevel ( line );
if ( XMLCTRL_HASBIT ( level, wxSTC_FOLDLEVELHEADERFLAG ) )
ToggleFold ( line ); for ( int iterator = line; iterator > 0; iterator--)
{
if (iterator != line)
{
GotoLine ( iterator );
level = GetFoldLevel ( iterator );
}
if ( XMLCTRL_HASBIT ( level, wxSTC_FOLDLEVELHEADERFLAG ) )
{
ToggleFold ( iterator );
break;
}
}
// was previously (changed so cursor doesn't have to be in headline):
// if ( XMLCTRL_HASBIT ( level, wxSTC_FOLDLEVELHEADERFLAG ) )
// ToggleFold ( line );
} }
// adapted from wxSTEdit (c) 2005 John Labenski, Otto Wyss // adapted from wxSTEdit (c) 2005 John Labenski, Otto Wyss