fix: opening bracket insertion fails after autocomplete#3
Merged
Conversation
Skip-over rules incorrectly matched opening bracket events because both
opening `(` and closing `)` bracket rules matched `InsertString("()")`.
Fix by:
- Binding closing brackets to `InsertChar(close_char)` in keybindings
- Updating skip-over rules to match `InsertChar` for brackets
This distinguishes opening bracket key presses (InsertString + MoveLeft)
from closing bracket key presses (InsertChar).
Co-Authored-By: Claude Opus 4.5 <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where pressing an opening bracket key after autocomplete would incorrectly trigger skip-over behavior instead of inserting a bracket pair. The root cause was that skip-over rules were matching the opening bracket's InsertString(pair) + MoveLeft event instead of only matching the closing bracket's InsertChar event.
Changes:
- Modified skip-over rules to distinguish between opening and closing bracket events by matching
InsertCharfor brackets andInsertString + MoveLeftfor quotes - Updated keybindings to bind closing bracket characters to
InsertCharevents - Added comprehensive tests to verify the fix and prevent regression
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/arf-console/src/editor/mode.rs | Refactored create_skip_over_rules() to separate bracket and quote handling, and added extensive tests for the fix |
| crates/arf-console/src/editor/keybindings.rs | Updated add_auto_match_keybindings() to bind closing brackets to InsertChar events |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| let rules = create_skip_over_rules(); | ||
|
|
||
| // First 3 rules are for brackets: `)`, `]`, `}` | ||
| for (i, close_char) in [')' , ']', '}'].iter().enumerate() { |
There was a problem hiding this comment.
Extra space before comma after ')' character. Should be [')' , → [')',
eitsupi
added a commit
that referenced
this pull request
Feb 11, 2026
- Fix fd leak when PENDING_TERMIOS_RESTORE mutex is poisoned after successful tcgetattr (finding #2) - Restore comment explaining intentional if guard in write_empty_password for release builds where debug_assert is stripped (finding #3) - Document that rpassword's internal fd leaks on longjmp as a known minor limitation (finding #1) - Note UTF-8 restriction from rpassword vs previous raw bytes (finding #4) Co-Authored-By: Claude Opus 4.6 <[email protected]>
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.
No description provided.