Skip to content

fix(input): repaint tab bar on every rename keystroke#35

Open
roramirez wants to merge 2 commits into
mainfrom
fix/render-rename-tab
Open

fix(input): repaint tab bar on every rename keystroke#35
roramirez wants to merge 2 commits into
mainfrom
fix/render-rename-tab

Conversation

@roramirez

Copy link
Copy Markdown
Owner

Summary

  • request_redraw() was missing after handle_rename_key in try_dispatch_mode_key — typed characters accumulated in the mode buffer but the tab bar only repainted on the next unrelated event (e.g. PTY output)
  • Extracted rename buf-mutation logic into AppState::apply_rename_key(&Key) to make it testable without constructing a winit::KeyEvent
  • Simplified try_dispatch_mode_key using a single match — NLL releases the scrutinee borrow before each arm body, so request_redraw and the return value collapse to one site

Test plan

  • Open rename mode (Ctrl+Shift+R or command palette), type — tab bar updates immediately on every keystroke
  • Enter commits the name; Escape cancels without renaming; Backspace removes last char
  • cargo test — 6 new regression tests in app_state_test.rs covering all rename key paths

request_redraw() was called after handle_search_key,
handle_command_palette_key, and handle_screenshot_name_key but was
missing after handle_rename_key — so typed characters accumulated in
the mode buffer but the tab bar only repainted on the next unrelated
event.

Extracted the buf-mutation logic into AppState::apply_rename_key(&Key)
so the rename behaviour is directly testable without constructing a
winit::KeyEvent. Added 6 regression tests covering char append,
backspace, Enter-commit, Enter-clears-empty-name, Escape-cancel, and
noop-when-not-in-rename-mode.
Replace four if/matches! blocks (each with request_redraw + return true)
with a single match on &self.state.mode. NLL releases the scrutinee
borrow before the arm body, so &mut self methods are callable inside
each arm. request_redraw and the return value collapse to one site.
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