feat: 2-row bars, console clear, registers collapse, fix re-entry layout

Cluster of UX refinements + one real bug:

Bar chrome:
- Shrunk both bars from 3 rows to 2 rows. dapui's own pane borders act
  as the visual separation between the bar and the main content area,
  so the inner-facing separator lines on each bar were redundant.
    Top bar:    sep / content       (no bottom line)
    Bottom bar: content / sep       (no top line)
- Sidebar/Console sizing recalculated: 2-row bars instead of 3 frees
  up 2 extra rows for content.

Smarter legend:
- (R)estart is now conditionally rendered — only shown when a dap
  session is active. When there's no session, "restart" is meaningless
  (there's nothing to restart), so the button hides and the remaining
  controls re-center around the smaller set.

Console clear on start/restart:
- New config.opts.clear_console_on_start (default true). Fires on
  dap.listeners.before.event_initialized — wipes the Console buffer
  so output from a previous run doesn't linger when a new session
  begins.

Registers default-collapsed:
- dapui's own scopes component auto-collapses any scope the adapter
  marks `expensive = true` (see dapui/components/scopes.lua:22-24).
  codelldb (Rust/C++) doesn't mark Registers expensive even though it
  dumps hundreds of entries. We intercept the scopes response via
  dap.listeners.before.scopes and inject `expensive = true` on any
  scope name in config.opts.collapsed_scopes (default `{"Registers"}`).
  Reuses dapui's existing collapse mechanism, so no monkey-patching.

Re-entry layout fix:
- The Console "balloon" bug on second ,dd toggle was dapui caching
  first-call layout dimensions. ensure_dapui() now re-runs dapui.setup
  with freshly computed layouts on EVERY M.enter, so the 25% / 25% /
  25% / 25% sidebar split and 15%-of-available Console all recompute
  against current terminal + current bar heights.
- Bars are now opened BEFORE dapui.open() so dapui's layout algorithm
  sees the reduced available space from the start rather than computing
  against full screen and then getting squished.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Opus 4.6 committed 2026-04-12 14:08:17 -06:00
1 parent fb695ce359
commit 988bd06d54
2 files changed
+104 -41

No files matched your search

+12
View File
@@ -22,6 +22,18 @@ M.defaults = {
-- outputs. Trailing-edge — max 1000/console_refresh_ms redraws per second.
console_refresh_ms = 50,
-- Scope names (from the DAP adapter) to default-collapse. dapui auto-
-- collapses scopes that the adapter marks `expensive`, but many adapters
-- (codelldb for Rust/C++, for example) don't mark Registers expensive
-- even though it's a huge dump. Any scope name in this list is treated
-- as expensive by intercepting the `scopes` response before dapui sees
-- it. Users can click/<CR> to expand manually.
collapsed_scopes = { "Registers" },
-- Clear the Console pane on session start/restart so old output from a
-- previous run doesn't linger. Set false to preserve across runs.
clear_console_on_start = true,
-- modal keys (active only during debug mode, single-key)
keys = {
continue = "c",