Conversation
Extend CTRL key handling to support symbol keys (@, [, \, ], ^, _) using the standard ASCII bitmask (key & 0x1F). Previously only alphabetic keys were handled, so CTRL+] (0x1D) was silently dropped. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Cache Font objects in GridPaintCache, rebuild only on style change - Use Arc::make_mut in merge_pane_render_rows to avoid cloning row Vecs when the Arc has a single owner - Use vec![default; cols] in fallback path instead of per-cell push loop - Batch event drain with 2048-event limit to keep UI responsive during massive output (e.g. cat huge_file) - Reuse dirty_col_ranges allocation across frames via resize+fill Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThis PR introduces performance optimizations across multiple layers: caching Font objects in the terminal grid to avoid per-call construction, extending control-key character mapping for keyboard input, implementing event draining with batch limits and a "has more" flag, and optimizing render row merging and cell initialization logic. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
This pull request introduces several optimizations and bug fixes to the terminal UI codebase, focusing on improving rendering efficiency, event handling, and keyboard input compatibility. The main changes include caching font objects to avoid redundant allocations, batching event draining to prevent UI stalls, fixing legacy control character handling, and optimizing row merging and cell initialization in rendering logic.
Rendering and Caching Optimizations:
cached_font_normalandcached_font_boldfields toTerminalGridPaintCache, rebuilding them only when the style changes to avoid unnecessary font object allocations. Fonts are now reused during painting, improving performance. [1] [2]Arc::make_mutfor efficient, copy-on-write updates, reducing unnecessary cloning of row data.Event Handling Improvements:
EVENT_DRAIN_BATCH_LIMIT) for draining terminal events (2048 per frame) to prevent massive output from blocking the render thread. The event draining functions now return whether more events remain, allowing the UI to schedule additional redraws if needed. [1] [2] [3] [4] [5]Keyboard Input Compatibility:
@,[, `This pull request introduces several optimizations and bug fixes to the terminal UI codebase, focusing on improving rendering efficiency, event handling, and keyboard input compatibility. The main changes include caching font objects to avoid redundant allocations, batching event draining to prevent UI stalls, fixing legacy control character handling, and optimizing row merging and cell initialization in rendering logic.Rendering and Caching Optimizations:
cached_font_normalandcached_font_boldfields toTerminalGridPaintCache, rebuilding them only when the style changes to avoid unnecessary font object allocations. Fonts are now reused during painting, improving performance. [1] [2]Arc::make_mutfor efficient, copy-on-write updates, reducing unnecessary cloning of row data.Event Handling Improvements:
EVENT_DRAIN_BATCH_LIMIT) for draining terminal events (2048 per frame) to prevent massive output from blocking the render thread. The event draining functions now return whether more events remain, allowing the UI to schedule additional redraws if needed. [1] [2] [3] [4] [5]Keyboard Input Compatibility:
,
],^, and_by mapping these to their correct ASCII control codes, improving compatibility with standard terminal control sequences. Added a test for CTRL+RightBracket. [1] [2]Other Minor Fixes:
These changes collectively enhance the terminal's performance, correctness, and compatibility, especially under heavy workloads and with legacy keyboard input.
Summary by CodeRabbit
Release Notes
New Features
Performance