fix(guide): keep the guide line from collapsing the layout#123
Open
laurigates wants to merge 1 commit into
Open
fix(guide): keep the guide line from collapsing the layout#123laurigates wants to merge 1 commit into
laurigates wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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::drawfilters out panes whosewrapped_linesis 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::Clearnow renders one blank line instead of an empty state.--no-hintis unchanged: the guide stays permanently empty (consistently zero rows), so there is no jump in that mode either.Testing
cargo fmt --all -- --checkcargo clippycargo testcargo build --binsAll 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.