fix(input): repaint tab bar on every rename keystroke#35
Open
roramirez wants to merge 2 commits into
Open
Conversation
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.
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.
Summary
request_redraw()was missing afterhandle_rename_keyintry_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)AppState::apply_rename_key(&Key)to make it testable without constructing awinit::KeyEventtry_dispatch_mode_keyusing a singlematch— NLL releases the scrutinee borrow before each arm body, sorequest_redrawand the return value collapse to one siteTest plan
Ctrl+Shift+Ror command palette), type — tab bar updates immediately on every keystrokeEntercommits the name;Escapecancels without renaming;Backspaceremoves last charcargo test— 6 new regression tests inapp_state_test.rscovering all rename key paths