fix(cli): remove quote-based drag detection to prevent input lag#2837
Merged
tanzhenxin merged 1 commit intoQwenLM:mainfrom Apr 5, 2026
Merged
fix(cli): remove quote-based drag detection to prevent input lag#2837tanzhenxin merged 1 commit intoQwenLM:mainfrom
tanzhenxin merged 1 commit intoQwenLM:mainfrom
Conversation
The previous implementation delayed broadcasting quote characters by 100ms
to detect file drag-and-drop operations. This caused noticeable input lag
when typing quotes, significantly impacting the typing experience.
Modern terminals use bracketed paste mode (PASTE_MODE_PREFIX) for file
drag-and-drop, which is already properly handled. The quote-based heuristic
was an unnecessary fallback that compromised responsiveness.
Changes:
- Remove quote character special handling in KeypressContext
- Remove unused drag-related refs and timers
- Remove drag cleanup code on exit
- Update tests to reflect immediate quote broadcasting
Impact:
- Eliminates input lag when typing quotes and other characters
- Maintains drag-and-drop support via bracketed paste mode
- Reduces code complexity (~75 lines removed)
- Legacy terminals without bracketed paste may need Ctrl+V for file paths
Fixes: input lag when typing single quote (') and double quote (") characters
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
e26c044 to
e6cb9d6
Compare
tanzhenxin
approved these changes
Apr 5, 2026
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.
TLDR
Fixes significant input lag when typing single quote (
') and double quote (") characters by removing the quote-based drag-and-drop detection mechanism. The previous implementation delayed broadcasting quote characters by 100ms, causing noticeable lag during normal typing. Modern terminals use bracketed paste mode for file drag-and-drop, making the quote-based heuristic unnecessary.Dive Deeper
Root Cause
The
KeypressContexthad a quote-based drag-and-drop detection mechanism that:This caused a 100ms delay on every quote keystroke, which is very noticeable during typing.
The Fix
Removed the quote-based drag detection entirely because:
PASTE_MODE_PREFIX = ESC[200~) for file drag-and-drop operationsChanges
isDraggingRef,dragBufferRef,draggingTimerRef)Impact
✅ Eliminates input lag when typing quotes and all other characters
⚠️ Legacy terminals that don't support bracketed paste for file drops may need to use Ctrl+V for pasting file paths (this is already supported)
✅ Maintains drag-and-drop support via bracketed paste mode (modern terminals)
✅ Cleaner, simpler code with less complexity
Reviewer Test Plan
bun install && bun startIt's working!echo "hello world"const x = 'test';bun testTesting Matrix
Tested on Linux with bun - quotes now appear instantly with no lag.
Linked issues / bug
Fixes input lag when typing quote characters (no existing issue filed)