Skip to content

fix: add sleep before Enter send to fix auto-submit on older WezTerm#160

Merged
bfly123 merged 1 commit intobfly123:mainfrom
M-Marbouh:fix/wezterm-enter-timing
Mar 31, 2026
Merged

fix: add sleep before Enter send to fix auto-submit on older WezTerm#160
bfly123 merged 1 commit intobfly123:mainfrom
M-Marbouh:fix/wezterm-enter-timing

Conversation

@M-Marbouh
Copy link
Copy Markdown
Contributor

Summary

  • WezTerm builds pre-dating send-key (e.g. 20240203-110809-5046fc22) fall through to the CR byte fallback in send_via_wezterm() immediately after send-text completes
  • Without a short delay, \r arrives before the TUI has finished processing the bracketed paste sequence — Claude Code ignores it and requires a manual Enter
  • Adds time.sleep(0.1) before any Enter-sending attempt, so the bracketed paste is fully consumed first

This reproduces the timing that was present in #149 and was inadvertently dropped in #151.

Root cause

_send_wezterm_enter() tries 6 send-key variants that all fail instantly on older WezTerm (unrecognized subcommand). The fallback \r is then sent with no delay — too fast for the TUI's paste handler.

Test plan

  • Tested on WezTerm 20240203 (no send-key): completion hook response auto-submits without manual Enter
  • Tested on newer WezTerm (has send-key): _send_wezterm_enter() succeeds as before, sleep is a no-op overhead

Related: #149, #151

WezTerm builds pre-dating send-key (e.g. 20240203) fall through to the
CR byte fallback immediately after send-text completes. Without a short
delay, the \r arrives before the TUI has finished processing the
bracketed paste sequence, causing Claude Code to ignore it and require
a manual Enter.

Add time.sleep(0.1) before any Enter-sending attempt so the bracketed
paste is fully consumed first. Reproduces the timing that was present
in bfly123#149 and was inadvertently dropped in bfly123#151.

Fixes: bfly123#149 regression introduced by bfly123#151 on older WezTerm versions.
@bfly123 bfly123 merged commit c078e4d into bfly123:main Mar 31, 2026
3 of 13 checks passed
@M-Marbouh M-Marbouh deleted the fix/wezterm-enter-timing branch March 31, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants