Windows performance optimizations: paste handling, shell compatibility, and message display#18367
Closed
devnezu wants to merge 5 commits intogoogle-gemini:mainfrom
Closed
Conversation
Intercept large paste events (>500 chars) BEFORE buffer processing to show placeholder text instantly. The full content is stored in refs and correctly substituted on submit. - Add fastPasteContentRef and fastPasteCounterRef for storage - Intercept terminal paste events before buffer.handleInput() - Intercept Ctrl+V paste before buffer.insert() - Update handleSubmitAndClear to use combined content from refs - Placeholders use existing [Pasted Text: X lines/chars] format
AI models predominantly generate bash/unix commands which fail on PowerShell with syntax errors (e.g. && operator, bash builtins). This change detects Git Bash installation and uses it as the preferred shell on Windows, falling back to PowerShell if not found. - Check common Git Bash installation paths - Use bash with -c flag when found - Maintain PowerShell fallback for systems without Git
Displaying messages with 50k+ characters causes terminal rendering to freeze for several seconds. This change truncates the visual display while still sending the full content to the model. - Limit display to 2000 chars or 50 lines - Show preview + character/line count for large messages - Full content is still sent to the model API - Prevents terminal UI freeze on large pastes
Address code review feedback: Replace direct mutation of buffer.pastedContent with proper React state management using the reducer pattern. Changes: - Add addPastedContent() method to TextBuffer interface - Extract duplicate paste logic into handleLargePaste() helper - Use buffer.addPastedContent() instead of direct mutation - Maintain compatibility with existing pastedContent system This fixes the critical bug where React state was being mutated directly, which could lead to unpredictable UI behavior and stale data.
Address code review feedback: Hardcoded paths fail for users with custom Git installation locations. Implement multi-method detection strategy: 1. Search for bash.exe in PATH environment variable (most reliable) 2. Verify it's Git Bash by checking path contains 'git' 3. Fall back to common installation paths 4. Include PROGRAMFILES(X86) for 32-bit installs This ensures Git Bash is detected regardless of installation location while maintaining PowerShell fallback for systems without Git.
Contributor
|
Warning Gemini encountered an error creating the summary. You can try again by commenting |
Contributor
|
Hi there! Thank you for your contribution to Gemini CLI. We really appreciate the time and effort you've put into this pull request. To keep our backlog manageable and ensure we're focusing on current priorities, we are closing pull requests that haven't seen maintainer activity for 30 days. Currently, the team is prioritizing work associated with 🔒 maintainer only or help wanted issues. If you believe this change is still critical, please feel free to comment with updated details. Otherwise, we encourage contributors to focus on open issues labeled as help wanted. Thank you for your understanding! |
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.
Fixes #18366
Summary
This PR addresses three critical performance and compatibility issues on Windows that make Gemini CLI nearly unusable for real-world workflows:
Changes
1. Fast Paste Handling (
InputPrompt.tsx)[Pasted Text: X chars]addPastedContent()method2. Message Display Truncation (
UserMessage.tsx)3. Git Bash Preference (
shell-utils.ts)bash.exefor command executionTesting
Extensively tested on Windows 11 with:
&&,||, pipesImplementation Details
Fast Paste Implementation:
handleLargePaste()helper function to eliminate code duplicationaddPastedContent()method to TextBuffer for immutable state updatesGit Bash Detection:
Backward Compatibility
All changes maintain full backward compatibility: