public static HexBufferSpan GetLineAnchorSpan(HexSelection selection) { if (selection == null) throw new ArgumentNullException(nameof(selection)); if (selection.IsEmpty) return selection.HexView.Caret.ContainingHexViewLine.BufferSpan; var anchorExtent = selection.HexView.GetHexViewLineContainingBufferPosition(selection.AnchorPoint).BufferSpan; if (selection.AnchorPoint >= selection.ActivePoint) { if (anchorExtent.Start == selection.AnchorPoint && selection.AnchorPoint > selection.HexView.BufferLines.BufferStart) anchorExtent = selection.HexView.GetHexViewLineContainingBufferPosition(selection.AnchorPoint - 1).BufferSpan; } return anchorExtent; }
public SelectionState(HexSelection selection) { state = (byte)(selection.IsEmpty ? 1 : 0); }