public static void AppendLineBelowToCurrentLine(Block higherSeparator) { if (higherSeparator == null || higherSeparator.Parent == null || higherSeparator.Parent.Next == null || higherSeparator.Next != null) { return; } ContainerBlock newParent = higherSeparator.Parent; ContainerBlock oldParent = newParent.Next as ContainerBlock; Block newFocus = null; if (oldParent == null) { return; } else { newFocus = oldParent.FindFirstFocusableBlock(); } ActionBuilder a = new ActionBuilder(higherSeparator.Root); a.DeleteBlock(higherSeparator); foreach (Block child in oldParent.Children) { a.MoveBlock(newParent, child); } a.DeleteBlock(oldParent); a.RunWithoutRedraw(); if (newFocus != null) { newFocus.SetFocus(true); } }
public static void SetCursorToTheBeginningOfLine(Block currentBlock) { if (currentBlock == null) { return; } ContainerBlock parent = currentBlock.Parent; if (parent == null) { return; } Block first = parent.FindFirstFocusableBlock(); if (first == null) { return; } first.SetCursorToTheBeginning(true); }