Skip to content

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

Description

@JDonaghy

Code-overview minimap on the right edge of each editor pane: a scaled-down rendering of the
whole file with the viewport highlighted, click/drag to scroll.

Rewritten 2026-08-31. Three changes from the previous revision: the TUI rendering
technique is now braille (not block-character approximation), the GTK technique is
stated as font scaling rather than "Cairo scaled rendering", and the on/off setting is
a hard requirement with its own acceptance criteria
, not a bullet under "Features". The
quadraui-first design is unchanged and is still the point of the issue. The "Key files"
list was also stale — render.rs and the backends moved.

Features

  • Click/drag to scroll the main editor
  • Syntax-coloured (dominant colour per rendered region)
  • Off/on via a minimap setting — see The setting below

Backends

backend technique density
GTK font scaling — real glyphs via Pango at a scaled-down absolute size (VS Code's minimap.renderCharacters: true), with a colour-bar fallback below the legibility floor 1 buffer line per ~2–6 px row
TUI brailleU+2800 dot cells, 2 dots wide × 4 tall per terminal cell 4 buffer lines per terminal row
Win-GUI out of scope until the Win backend ships in quadraui

Braille replaces the previous "block-character approximation, 1 cell per minimap line". It is
8× denser, and quadraui already has a working dot-packing implementation to lift from
(quadraui/src/tui/chart.rs:158:245, incl. the BRAILLE_OFFSETS bit table), so this is
cheaper and better than what it replaces.

Design: quadraui-first (platform-neutral) — the whole point of this issue

This feature must not add substantive logic to src/gtk/ or src/tui_main/. All scale
math, line sampling, colour aggregation and dot packing live in quadraui.

  1. quadraui prerequisite — quadraui#382 (Minimap primitive + both rasterisers):
    Minimap descriptor, Minimap::layout(), Backend::draw_minimap(), sample_lines(),
    aggregate_spans(), reserved_width(). Note that aggregate_spans aggregates per
    cell, not per line — a braille cell carries one foreground colour across 4 buffer
    lines, so per-line colours would force the TUI backend to re-reduce them, which is exactly
    the platform-specific arithmetic this design forbids.

  2. vimcode side (after the primitive lands and the pin is bumped):

    • build_minimap_data() in src/render.rs — samples lines, hands syntax spans to
      aggregate_spans, builds the Minimap. Returns None when the setting is off.
    • ScreenLayout (src/render.rs:4239) gains minimap: Option<RenderedMinimap>.
    • Editor content width comes from quadraui::minimap::reserved_width(..) in both
      backends — do not compute the reclaimed width twice.
    • Each backend calls backend.draw_minimap(rect, &minimap). Thin wiring only.
    • Click/drag routes through the existing ClickTarget system → standard scroll commands.

The setting (required)

A minimap: bool option, defaulting to on, following the indent_guides precedent
exactly. In src/core/settings.rs that is eight sites — the option plumbing here is a
checklist, and missing one produces an option that works from :set but not from the
settings UI (or vice versa):

what indent_guides reference
field + #[serde(default = ...)] :296
default_minimap() :339
entry in the Default construction :788
parse_set_option boolean branch (minimap / nominimap) :1082
:set minimap? query form :1342
get-by-key string :1475
set-by-key string :1589
SettingDef { key, label, description, category: "Editor", setting_type: Bool } registry entry :2038

Both spellings (minimap and nominimap) must work, and the setting must take effect on the
next paint without a restart — the editor reclaims the minimap's width when it is turned off.

Key files

  • src/render.rsbuild_minimap_data(), ScreenLayout.minimap (:4239)
  • src/core/settings.rs — the eight sites above
  • src/gtk/mod.rs — thin draw_minimap wiring
  • src/tui_main/render_impl.rs — thin draw_minimap wiring
  • Cargo.toml — quadraui rev pin bump (vimcode#691: rev-pinned, not a path dep;
    cargo update -p quadraui will not move it)
  • quadraui: primitives/minimap.rs, gtk/minimap.rs, tui/minimap.rs

Acceptance

  • :set nominimap hides it and the editor text area widens by exactly the reserved width;
    :set minimap restores both — asserted, not eyeballed
  • :set minimap? reports minimap / nominimap
  • the setting round-trips through the settings file and appears in the settings UI list
  • TUI: a snapshot test (src/tui_main/snapshots/) covering a file with a distinctive
    indentation shape, showing braille glyphs — the snapshot is what pins that the dot grid
    is not transposed
  • GTK: a pixel assertion in src/gtk/testing.rs that the minimap column is painted and
    that its width matches reserved_width
  • click at the vertical middle of the minimap scrolls to ~50% of the file, in both
    backends
  • platform-neutrality gate: grep -rn 'minimap' src/gtk/ src/tui_main/ returns only
    draw_minimap call sites and rect plumbing — no sampling, no scale arithmetic, no dot
    packing, no colour aggregation. If a reviewer finds any of those outside quadraui, that
    is a request-changes regardless of whether it works.

Blocked on

quadraui#382 (Minimap primitive), then a Cargo.toml pin bump here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    coordTracked by coord-tui pipelinefeatureNew featurestatus:readyRefined and ready to enter the work pipeline

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions