fix(input): keep a Return the completion menu took from typing a newline - #6
Merged
Merged
Conversation
The completion and code action menus called cx.propagate() before taking a key, so a key they handled still went on. A real Return carries the text it types, so after the menu accepted a completion the newline was typed too. A key the menu takes now stops there. Co-Authored-By: Claude Code
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.
The completion and code action menus called
cx.propagate()at the top ofhandle_action, before they took the key. A key they handled therefore carried on. A real Return carries the text it types (key_char), so once the completion menu accepted an item, the newline was typed after it. The kit's own test missed this becausepresssends nokey_char.A key the menu takes now stops there. A key it does not take returns
falseas before, and the editor handles it.Public API
None.
Tests
a_return_that_types_a_newline_accepts_without_oneincrates/kit/tests/input/completions.rsdispatches a Return with itskey_char. It fails without the fix (print\n) and passes with it.Written with Claude Code (AI-generated).