Files
helder/TODO-editor-pointer-and-show-diff.md
T

2.8 KiB

To do: editor pointer flicker and "Show diff"

Status on 2026-10-07: items 2 and 3 built and tested (not yet checked in the running app); item 1 open.

1. Pointer flicker on a changed file

A file with a git change shows its changed lines with a tinted background.

  • Hover over the editor without a menu: steady pointer. Fixed: the line-number gutter is cut out of the I-beam rect (visibleRectWithoutScrollers in Components/PointerPolicy.swift).
  • With the right-click menu open on a changed file, moving the mouse still flickers a bit between arrow and I-beam. Expected: a steady arrow over the menu and over every column behind it.
    • Suspects: CodeTextView's mouseMoved tracking area, NSTextView's own mouseEntered → _mouseInside: (already re-routed in PointerBoundTextView), the I-beam cursor rects of the CodeScrollView clip view, row-background redraws that reset cursor rects, and SwiftUI updates of the editor while the file changes on disk.
    • Find the setter at runtime with a temporary NSCursor.set trace, fix it through PointerPolicy, then remove the trace.

2. Show diff from the right-click menu, not from a click

  • A left click on a changed line places the caret like any line, and never opens the Diff. Remove CodeEditorController.plainClick, actions.markedLineClicked, the call in CodeTextView.mouseDown and the wiring in EditorPane.swift (editor.openDiff(atLine:)).
  • A right-click on a changed line shows the editor menu with a separator and Show diff below Pass on reference / Copy reference. It opens the Diff of that file at that line (editor.openDiff(atLine:)).
    • Every marked line counts, including blank added lines and the area after the last glyph of a line.
    • Same conditions as the old click: Actual mode, the file has a diff, not a newly added file (EditorPresentation.opensDiffOnClick, rename it).
    • An unchanged line: menu unchanged. The menu in DiffOverlayView gets no Show diff.
    • Plumbing: ContextActions.entries(for: .editor…), EditorStore.contextMenuRequest, WorkspaceModel+ContextActions.execute, tint and symbol in ContextMenuOverlay (same as .openDiff).

3. No header on the editor menu

  • The editor right-click menu loses its header line (for example sample.php:12), also in the Diff view. ContextActions.header returns "" for .editor. File, git-row and project-root menus keep theirs.

Done in this session (uncommitted)

  • Bouwen item on ontwikkelingen/<name> folders.
  • Arrow instead of the I-beam over the context menu where it covers the editor (PointerBoundTextView.mouseEntered).
  • No header on folder menus.

Verify

  • Tests and docs for each item, as in the earlier changes (docs/guide/right-click-menu.md, docs/behaviour.md).
  • Check in the running app; drive the mouse only when Jonathan is away from the machine.