Skip to content

#35: [retry] Minimap (code overview) — GTK font scaling, TUI braille, quadraui-owned logic, on/off setting - #714

Merged
JDonaghy merged 3 commits into
developfrom
issue-35-minimap-code-overview-gtk-font-scaling-t
Sep 1, 2026
Merged

#35: [retry] Minimap (code overview) — GTK font scaling, TUI braille, quadraui-owned logic, on/off setting#714
JDonaghy merged 3 commits into
developfrom
issue-35-minimap-code-overview-gtk-font-scaling-t

Conversation

@JDonaghy

Copy link
Copy Markdown
Owner

Closes #35

Automated PR opened by coordinator for review of issue #35.

JDonaghy and others added 2 commits August 31, 2026 18:13
… on/off setting

Bumps the quadraui pin to develop tip (adadfe9), which carries quadraui#382's
`Minimap` primitive + both rasterisers, and wires the vimcode side to it.

All sampling, scale arithmetic, colour aggregation and braille dot packing
live in quadraui. vimcode's share is:

- `src/render.rs`: `build_minimap_data()` maps the buffer + tree-sitter
  highlights into `quadraui::sample_lines` / `aggregate_spans`, and
  `ScreenLayout.minimap: Option<RenderedMinimap>` carries the result.
  The active window's rect is narrowed by `quadraui::reserved_width(..)`
  before layout, so the editor reclaims exactly that width when the
  setting is off. `draw_minimap_strip` / `apply_minimap_click` are the
  entire backend-side contract.
- `src/core/settings.rs`: `minimap: bool`, default on, plumbed through all
  eight `indent_guides`-precedent sites (`minimap` / `nominimap`,
  `:set minimap?`, get/set-by-key, serde default, `SETTING_DEFS`).
- both backends: one `draw_minimap_strip` paint call and one
  `apply_minimap_click` hit-test call each. `grep -rn minimap src/gtk/
  src/tui_main/` returns only those five delegating call sites.

Tests (black-box, both backends):
- settings: default-on, both spellings, query form, by-key round trip,
  settings-file round trip incl. a pre-#35 file, registry entry
- render: `nominimap` widens the editor by exactly MINIMAP_COLS,
  reserved_width in cell + pixel units, narrow-window suppression,
  click at middle -> ~50%, top/bottom/miss, sampling order + shape
- TUI: `minimap_braille` snapshot over a lopsided indent shape (pins the
  dot grid is not transposed), plus TuiDriver tests for braille painting,
  the off state, and click-to-50%
- GTK: GtkDriver pixel assertion that the strip paints and that the
  editor regains exactly MINIMAP_COLS columns / the strip's pixels

Existing TUI snapshots re-accepted: the minimap is on by default, so the
right-hand 12 columns of every golden frame now carry braille.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…tting

The minimap is carved off the *active* window's right edge, which in a
`:vsplit` puts it flush against the divider's grab column — the TUI's
early minimap hit-test swallowed the drag and broke
`window_divider_click_starts_drag_and_resizes`. Moved the check below both
divider hit-tests, so the more destructive gesture wins. GTK already had
this ordering (its divider hit-tests run in `handle_mouse_press`, before
`pixel_to_click_target` is ever called).

Also documents `minimap` / `nominimap` in README's `:set` table.

Full `cargo test`, `cargo clippy -- -D warnings`,
`cargo clippy --no-default-features -- -D warnings` and
`cargo fmt -- --check` all clean.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…ions

Review findings addressed (iteration 1):

- GTK minimap drag-to-scroll was dead: pixel_to_click_target only
  hit-tested the minimap when mutate_focus was true, and
  handle_mouse_drag (the drag-continuation path) always called it with
  mutate_focus: false, so a press-and-hold drag never reached the
  minimap resolver after the initial mouse-down. handle_mouse_drag now
  checks apply_minimap_click first and unconditionally, matching
  src/tui_main/mouse.rs's existing unconditional Down/Drag handling —
  the parity claim in that file's comment is now actually true. Added
  gtk::testing::minimap::minimap_drag_keeps_seeking_while_the_button_is_held,
  which drives a real mouse_down + mouse_move gesture through
  handle_mouse_drag_msg and fails pre-fix.

- gtk::testing::minimap::minimap_click_at_the_middle_scrolls_to_half_the_file
  asserted only on `scroll_top()` (internal state), which would pass
  even if the click mutated state but the frame never repainted
  (#587/#592 shape). Rewritten to also assert on painted pixels: counts
  non-grayscale ("colorful", i.e. syntax-highlighted) pixels in the
  band right after the gutter, which must drop to zero once the view
  scrolls into the fixture's indented band. (A brightness-based first
  attempt at this probe turned out to be theme-dependent noise —
  documented in the test's own comment.)

- Every new/rewritten driver-tier test in this fix (both GTK tests, and
  the four TUI tests flagged: snapshot_minimap_braille,
  nominimap_paints_no_braille, render_content_paints_minimap_braille_via_shell_app,
  render_content_paints_no_minimap_when_the_setting_is_off,
  minimap_click_at_the_middle_scrolls_to_half_the_file) now carries a
  verified RED-first statement: the relevant production code path was
  temporarily reverted, the test confirmed failing, then the fix was
  restored — per CLAUDE.md's black-box coverage rule.

Non-blocking items from the review (minimap_click_line calling the
primitive's own .layout() instead of Backend::minimap_layout; the
single-active-window minimap scope; narrow-window suppression only
being unit-tested directly) are left as-is — see the final report for
why each was deferred rather than blindly patched.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@JDonaghy
JDonaghy merged commit 97dcecd into develop Sep 1, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Minimap (code overview) — GTK font scaling, TUI braille, quadraui-owned logic, on/off setting

1 participant