public override void HandleMouseDown(Point mousepos, MouseButtons mouseButtons)
{
bool showFolding = textArea.Document.TextEditorProperties.EnableFolding;
int physicalLine = + (int)((mousepos.Y + textArea.VirtualTop.Y) / textArea.TextView.FontHeight);
int realline = textArea.Document.GetFirstLogicalLine(physicalLine);
// focus the textarea if the user clicks on the line number view
textArea.Focus();
if (!showFolding || realline < 0 || realline + 1 >= textArea.Document.TotalNumberOfLines) {
return;
}
List<FoldMarker> foldMarkers = textArea.Document.FoldingManager.GetFoldingsWithStart(realline);
foreach (FoldMarker fm in foldMarkers) {
fm.IsFolded = !fm.IsFolded;
}
textArea.Document.FoldingManager.NotifyFoldingsChanged(EventArgs.Empty);
}