Fix vterm-copy-mode disrupted by anti-flicker timer in Claude Code sessions#241
Draft
Fix vterm-copy-mode disrupted by anti-flicker timer in Claude Code sessions#241
Conversation
Claude Code produces complex ANSI output that triggers the anti-flicker batching in vterm-smart-renderer. When the deferred render timer fired during vterm-copy-mode, it called vterm--filter and disrupted the user's copy/scroll position. Other CLIs (Gemini, Codex) produced simpler output that rarely triggered the batching, so they were unaffected. Changes: - Add (bound-and-true-p vterm-copy-mode) to the batching condition so all incoming data is queued (not immediately rendered) while copy mode is on - In the render timer callback, clear the timer ref unconditionally but skip calling vterm--filter when vterm-copy-mode is still active, preserving the queue for later - Add ai-code-backends-infra--vterm-flush-on-copy-mode-exit which flushes the pending render queue when the user exits copy mode (no output lost) - Install the flush function buffer-locally on vterm-copy-mode-hook in ai-code-backends-infra--configure-vterm-buffer - Declare vterm-copy-mode defvar for byte-compilation correctness - Add 4 ERT tests covering the new copy-mode-aware behaviour Co-authored-by: tninja <714625+tninja@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix Vterm-Copy mode issue for Claude
Fix vterm-copy-mode disrupted by anti-flicker timer in Claude Code sessions
Mar 18, 2026
## Summary This PR adds a comprehensive behavior injection system for AI prompts, enabling backend-agnostic behaviors integration with the ai-behaviors repository. ## Features ### 1. Behavior Hashtags - Operating modes: #=code, #=debug, #=research, #=review, #=spec, #=test - Modifiers: #deep, #tdd, #challenge, #wide, #ground, #concise, etc. - Constraint modifiers: #chinese, #english, #test-after, #strict-lint, etc. ### 2. Preset System - Syntax: @preset-name to apply behavior presets - 8 built-in presets: @tdd-dev, @thorough-debug, @quick-review, etc. - Merging: @tdd-dev #chinese applies preset + adds constraint ### 3. Session-Scoped State - Behaviors persist across prompts within a session - Project-scoped: each git repository has independent behavior state - Mode-line indicator shows active behaviors with color coding ### 4. Auto-Preset Detection - Detects appropriate preset from context signals (filename, major-mode, git branch) ### 5. TAB Completion - Type #dee TAB → completes to #deep - Type @qui TAB → completes to @Quick-Fix or @quick-review ## Integration Fully encapsulated via advice in ai-code-behaviors.el: - Users must explicitly (require 'ai-code-behaviors) - No changes to core ai-code files - Integration via advice-add around ai-code--insert-prompt ## Also Includes - ECA API fix: eca-chat-send-prompt signature change (session removed) Co-authored-by: Wu David <davidwuchn@gmail.com>
…/ai-code-interface.el into copilot/fix-vterm-copy-mode-issue
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.
Claude Code's complex ANSI output (spinners, progress redraws) consistently triggers the anti-flicker batching in
vterm-smart-renderer. When the deferred render timer fired duringvterm-copy-mode, it calledvterm--filterand jumped the cursor back to the terminal bottom, making copy mode unusable. Simpler CLIs (Gemini, Codex) rarely hit the batching threshold, so they were unaffected.Changes
ai-code-backends-infra--vterm-smart-renderer: adds(bound-and-true-p vterm-copy-mode)to the batching predicate so all incoming data is queued rather than immediately rendered while copy mode is active; the timer callback now clears its own reference unconditionally but skips callingvterm--filterwhen copy mode is still on, preserving the queue.ai-code-backends-infra--vterm-flush-on-copy-mode-exit: new function that drains the pending render queue the moment the user exits copy mode — no output is lost.ai-code-backends-infra--configure-vterm-buffer: installs the flush function as a buffer-localvterm-copy-mode-hook.(defvar vterm-copy-mode): forward declaration added alongside the other vterm dynamic-variable declarations for clean byte-compilation.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
www.reddit.com/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.