Skip to content

feat(code-editor): caret position tick + selection range block in CodeScrollMarkerPanel #205

@abbaye

Description

@abbaye

Summary

Extend CodeScrollMarkerPanel with two new visual indicators overlaid on the vertical scrollbar:

  • A bright yellow tick for the current caret line.
  • A semi-transparent blue block spanning the active multi-line selection.

This gives VS-like at-a-glance position awareness on long files without any additional UI chrome.

Implementation

CodeScrollMarkerPanel

  • New state fields: _caretLine, _selectionStart, _selectionEnd.
  • New API: UpdateCaretAndSelection(int caretLine, int selStart, int selEnd, int totalLines).
    • selStart == -1 → no selection block rendered.
    • totalLines parameter used as proportional denominator (fold-corrected).
  • Z-order in OnRender: selection block → word-highlight ticks → caret tick (caret always topmost).
  • Static frozen brushes:
    • s_caretTickARGB(220, 255, 255, 100) bright yellow.
    • s_selectionBlockARGB(70, 86, 156, 214) semi-transparent blue.

CodeEditor wiring

  • Called from the render pass (OnRender) every frame with the current _cursorLine, selection bounds (only when selection spans multiple lines), and fold-corrected visibleLines.

Affected files

  • Sources/WpfHexEditor.Editor.CodeEditor/Controls/CodeScrollMarkerPanel.cs
  • Sources/WpfHexEditor.Editor.CodeEditor/Controls/CodeEditor.csOnRender

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions