Skip to content

Minimap is one strip for the active pane only (migrates on focus change, reflowing both panes) and its width is a fixed 12 char cells, not a fraction of the view #722

Description

@JDonaghy

Problem

Two defects in vimcode's minimap geometry, both in the same ~70 lines of
build_screen_layout (src/render.rs:67626842), so they land together.

A. One minimap for the whole screen, not one per editor pane

#35 specified "a minimap on the right edge of each editor pane". What shipped is
singular and gated on the active window — twice:

// src/render.rs:6768-6772  — width reclaim
let minimap_w = window_rects.iter()
    .find(|(id, _)| *id == active_window_id)          // <-- only the active pane
    .map(|(_, r)| minimap_reserved_width(engine, r.width, char_width))
    .unwrap_or(0.0);
// src/render.rs:6783-6788  — applied to that pane alone
if is_active { (rect.width - minimap_w).max(0.0) } else { rect.width }
// src/render.rs:6819-6823  — and only that pane gets a strip built
let minimap = if minimap_w > 0.0 {
    window_rects.iter().find(|(id, _)| *id == active_window_id)

and the type is singular too — ScreenLayout.minimap: Option<RenderedMinimap>
(src/render.rs:4344), documented as "for the active editor window".

Consequences, both observed in a split:

  • Only one pane has a minimap; the other has none.
  • The minimap migrates as you change focus, and because the width reclaim is gated on the
    same is_active flag, both panes reflow their text every time you switch panes. That is
    a worse symptom than the missing strip.

Fix: ScreenLayout.minimap becomes a collection (per WindowId), the reclaim applies to
every window rect, and the build maps over window_rects instead of find-ing the active
one. draw_minimap_strip / minimap_click_line / apply_minimap_click then iterate; the
WidgetId is already per-window (format!("minimap:{}", window_id.0)), so quadraui needs
nothing new for this part.

B. Width is a fixed character-cell count, so it is not a consistent fraction of the view

// src/render.rs:4352
pub const MINIMAP_COLS: usize = 12;

multiplied by char_width. That ties the minimap's width to the editor font size and
leaves it constant as the window grows:

  • Widen the window → the strip stays 12 chars → the minimap becomes a smaller and smaller
    fraction of the view.
  • Bump the editor font → the minimap gets wider, which is backwards.
  • Split the window → each pane is narrower but the strip is the same absolute width, so it
    eats a much larger share of a split pane.

VS Code keeps the minimap at a consistent fraction of the editor regardless of font size or
window width.

Fix: derive the reserved width from a proportion of the pane's width, clamped to a
sensible min/max in pixels, and stop multiplying by char_width. Keep MINIMAP_MIN_TEXT_COLS
as the suppression floor — that part is right.

The exact target fraction should be measured against VS Code rather than guessed; match
what VS Code actually renders at a couple of window widths and font sizes and pin it in a
test. Note VS Code's own minimap width is independent of the editor font, which is the
property that matters most here.

Ordering

minimap_reserved_width is the single source of truth both backends and
build_screen_layout read (that was the point of #35's design), so B is a change to that one
function plus the constant — do not reintroduce a second width computation in a backend.

Acceptance

  • In a :vsplit, both panes show their own minimap over their own buffer.
  • Switching focus between panes does not change either pane's text width — assert the
    window rects are identical across a focus change with the minimap on.
  • The reserved width is unchanged when the editor font size changes, and scales with pane
    width — both asserted, not eyeballed.
  • :set nominimap still reclaims exactly the reserved width in every pane
    (nominimap_widens_the_editor_by_exactly_the_reserved_width at src/render.rs:16305
    extended to the split case).
  • The #35 platform-neutrality gate still holds: grep -rn 'minimap' src/gtk/ src/tui_main/
    returns only call sites and rect plumbing.

Related

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

    bugSomething isn't workingcoordTracked by coord-tui pipelinestatus:readyRefined and ready to enter the work pipelineuiUI/rendering

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions