Skip to content

fix: render path suggestions as floating overlay to prevent dialog jump#449

Open
oryaacov wants to merge 2 commits intoasheshgoplani:mainfrom
oryaacov:fix/path-suggestions-overlay
Open

fix: render path suggestions as floating overlay to prevent dialog jump#449
oryaacov wants to merge 2 commits intoasheshgoplani:mainfrom
oryaacov:fix/path-suggestions-overlay

Conversation

@oryaacov
Copy link
Copy Markdown

@oryaacov oryaacov commented Mar 27, 2026

Summary

  • New session dialog layout jump: When focusing/unfocusing the path field, the suggestions dropdown added ~3-7 lines inline, causing the entire dialog to resize and jump. This was disorienting when tabbing through fields.
  • Fix: Render path suggestions as a floating overlay (z-index style) that paints on top of the dialog content instead of being part of the content flow. The dialog size stays constant regardless of whether suggestions are visible.
Screenshot From 2026-03-27 21-22-10 Screenshot From 2026-03-27 21-22-27 Screenshot From 2026-03-27 21-22-44

Changes

Commit 1: Overlay infrastructure (feat)

  • overlayDropdown(base, overlay, row, col) — paints a multi-line string on top of a rendered TUI screen at a specific position, ANSI-aware
  • truncateVisible / sliceVisibleFrom — ANSI-safe string slicing helpers for the overlay
  • dropdownMenuBg() — returns a slightly elevated background color (dark: #292e42, light: #dcdde2) to distinguish the menu from the dialog surface
  • renderSuggestionsDropdown() — renders path suggestions as a bordered floating menu with distinct background and keybinding footer
  • 4 unit tests for the overlay helpers

Commit 2: Usage (fix)

  • Remove inline suggestion rendering from both single-path and multi-repo code paths (eliminates duplicated ~55-line blocks)
  • Track suggestionsLineOffset during content building to know where to position the overlay
  • After lipgloss.Place centers the dialog, overlay the suggestions menu at the computed position

Visual behavior

Before After
Dialog grows/shrinks when suggestions appear Dialog stays fixed size
Suggestions are inline, push content down Suggestions float over content below
No visual separation from dialog Bordered menu with distinct background

Test plan

  • All existing TestNewDialog_* tests pass (47 tests)
  • New TestOverlayDropdown_* tests pass (4 tests)
  • Full internal/ui test suite passes
  • Manual: open new session dialog, tab to path field — suggestions appear without layout shift
  • Manual: tab away from path field — suggestions disappear without layout shift
  • Manual: verify dark and light themes both render the menu background correctly

🤖 Generated with Claude Code

oryaacov and others added 2 commits March 27, 2026 20:20
Add ANSI-aware overlay helpers (overlayDropdown, truncateVisible,
sliceVisibleFrom) that paint a multi-line string on top of a rendered
TUI screen at a specific row/col, giving a z-index effect. Also adds
renderSuggestionsDropdown which renders path suggestions as a bordered
floating menu with a distinct background color and keybinding footer.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace inline path suggestion rendering with the overlay dropdown from
the previous commit. The suggestions now float over the dialog content
below them instead of pushing it down, eliminating the layout jump when
navigating to/from the path field. Both single-path and multi-repo
modes use the shared overlay.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant