public void HandleFolding(FoldClickedMessage message) { if (message.State == FoldingStates.FOLDED) { var diff = message.AreaBeforeFolding.EndPosition.Line - message.AreaBeforeFolding.StartPosition.Line; linesCount -= diff; while (diff > 0) { Pop(); diff--; } } else { var diff = message.AreaAfterFolding.EndPosition.Line - message.AreaAfterFolding.StartPosition.Line; linesCount += diff; while (diff > 0) { Push(); diff--; } } UpdateSize(); }
public override void HandleTextFolding(FoldClickedMessage message) { if (message.State == FoldingStates.EXPANDED) { ExpandText(message); } else { CollapseText(message); } }
public void CollapseText(FoldClickedMessage message) { var algorithm = CollapseRepresentationAlgorithmFactory.GetAlgorithm(ConfigManager.GetConfig(EditorCode).FormattingType); var collapsedLine = collapsingAlgorithm.CollapseTextRange(message.AreaBeforeFolding, GetScreenLines(), algorithm); var linesToRedraw = collapsingAlgorithm.GetLinesToRedrawAfterCollapse(visuals.ToEnumerableOf <VisualTextLine>().ToList(), collapsedLine, message.AreaBeforeFolding); if (message.AreaBeforeFolding.StartPosition.Line != message.AreaBeforeFolding.EndPosition.Line) { visuals.RemoveRange(message.AreaBeforeFolding.StartPosition.Line, visuals.Count - (message.AreaBeforeFolding.StartPosition.Line + 1)); } RedrawCollapsedLine(collapsedLine, message.AreaBeforeFolding.StartPosition.Line); AddLines(linesToRedraw); UpdateSize(); }
public void ExpandText(FoldClickedMessage message) { var collapseIndex = message.AreaBeforeFolding.StartPosition.Line; var collapsedLineContent = ((VisualTextLine)visuals[collapseIndex]).GetStringContents(); var expandedLines = collapsedLineContent.Select((line, index) => VisualTextLine.Create(line, collapseIndex + index)).ToArray(); var linesToRedraw = collapsingAlgorithm.GetLinesToRedrawAfterExpand(visuals.ToEnumerableOf <VisualTextLine>().Where(line => line.Index > message.AreaBeforeFolding.StartPosition.Line), expandedLines.Length - 1); visuals.RemoveRange(collapseIndex, LinesCount - collapseIndex); foreach (var line in expandedLines) { visuals.Insert(line.Index, line); line.Draw(); } AddLines(linesToRedraw); UpdateSize(); }
public override void HandleTextFolding(FoldClickedMessage message) { if (message.State == FoldingStates.FOLDED) { if (IsCaretInbetweenTags(message.AreaAfterFolding)) { MoveCaret(message.AreaAfterFolding.EndPosition); } else if (IsFoldMultiline(message.AreaBeforeFolding)) { MoveCaret(message.AreaAfterFolding.EndPosition); } } else { if (IsCaretInbetweenTags(message.AreaBeforeFolding)) { MoveCaret(new TextPosition(column: message.AreaAfterFolding.EndPosition.Column + 1, line: message.AreaAfterFolding.EndPosition.Line)); } } }
public abstract void HandleTextFolding(FoldClickedMessage message);
public override void HandleTextFolding(FoldClickedMessage message) => Deselect();