Skip to content

fix(guide): keep the guide line from collapsing the layout#123

Open
laurigates wants to merge 1 commit into
ynqa:mainfrom
laurigates:feat/stable-guide-line
Open

fix(guide): keep the guide line from collapsing the layout#123
laurigates wants to merge 1 commit into
ynqa:mainfrom
laurigates:feat/stable-guide-line

Conversation

@laurigates

Copy link
Copy Markdown

Problem

The TUI stacks four panes vertically: query editor, guide, completion, and JSON viewer. The guide line shows transient status messages (result: …, jq failed: …, copy notifications, etc.).

When there was no message to show, the guide was rendered from an empty status::State, which produces zero rows. The renderer drops zero-row panes entirely (Terminal::draw filters out panes whose wrapped_lines is empty), so the guide line disappeared and the JSON viewer slid up by one row. As soon as a status message appeared, the pane reclaimed its row and pushed everything back down.

The result: on every keystroke that toggled a status message on or off, the entire JSON view jumped up and down — distracting during normal editing.

Fix

Reserve the guide line as a single blank row whenever there is no message, so the pane never collapses to zero rows and the panes below it stay put:

  • GuideAction::Clear now renders one blank line instead of an empty state.
  • The initial render reserves the same blank row, so the layout is stable from the first frame (previously the first status message would shift everything down).

--no-hint is unchanged: the guide stays permanently empty (consistently zero rows), so there is no jump in that mode either.

Testing

  • cargo fmt --all -- --check
  • cargo clippy
  • cargo test
  • cargo build --bins

All pass. The behavior is a TUI layout change best confirmed interactively: type a filter that toggles between valid and invalid (e.g. ..foo. ) and observe the JSON view no longer jumps as the status line appears/disappears.

The UI stacks four panes vertically (query editor, guide, completion,
JSON viewer). When the guide had no message to show it was rendered from
an empty `status::State`, which produces zero rows. The renderer drops
zero-row panes entirely, so the guide line vanished and the JSON viewer
slid up — then a status message (e.g. "jq failed") brought the pane back
and pushed everything down again. On every keystroke that toggled a
message on/off, the JSON content jumped up and down, which is distracting.

Reserve the guide line as a single blank row when there is no message, so
the pane never collapses and the panes below it stay put. The initial
render does the same so the layout is stable from the first frame.
`--no-hint` is unchanged: the guide stays permanently empty.
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