Skip to content

tui: remove the win32 ENABLE_PROCESSED_INPUT ffi shim - #43604

Merged
Hona merged 1 commit into
anomalyco:v2from
Jarred-Sumner:claude/ffi-buffer-args
Aug 20, 2026
Merged

tui: remove the win32 ENABLE_PROCESSED_INPUT ffi shim#43604
Hona merged 1 commit into
anomalyco:v2from
Jarred-Sumner:claude/ffi-buffer-args

Conversation

@Jarred-Sumner

@Jarred-Sumner Jarred-Sumner commented Aug 20, 2026

Copy link
Copy Markdown

Issue for this PR

Refactor — removes a workaround for oven-sh/bun#31941 / #13052-era Bun behaviour. No opencode issue.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Heads up: this is speculative and Claude wrote it; it has not been run on Windows. Posting it from the Bun side because we think the shim is redundant and want to know if it isn't.

Deletes packages/tui/src/terminal-win32.{ts,bun.ts,node.ts} and its two call sites (win32DisableProcessedInput() after createCliRenderer(), win32FlushInputBuffer() at exit). The polling win32InstallCtrlCGuard() already had no callers on v2.

Why it shouldn't be needed: opentui's renderer calls process.stdin.setRawMode(true). On Windows, in both Bun and Node, that's libuv uv_tty_set_mode(UV_TTY_MODE_RAW_VT)SetConsoleMode(stdin, ENABLE_WINDOW_INPUT | ENABLE_VIRTUAL_TERMINAL_INPUT), which already clears ENABLE_PROCESSED_INPUT, so Ctrl+C arrives as \x03 on stdin and no CTRL_C_EVENT is generated. Neither runtime re-adds the flag afterwards. The shim re-did that by hand via dlopen("kernel32.dll"), and its old 100 ms Get/SetConsoleMode poller is what triggered oven-sh/bun#31941.

Bun fixes that landed after #13052: oven-sh/bun#30288 (process.stdin.isRaw never set on Windows → teardown paths re-cooked stdin on a later tick), oven-sh/bun#33527 (raw-mode state per handle). The remaining related Bun bug — bun run <script> / the global-bin .exe shim exiting on CTRL_C_EVENT while the child keeps running (oven-sh/bun#11400) — is oven-sh/bun#39729; it only affects a raw-mode TUI if something else turned ENABLE_PROCESSED_INPUT back on.

If Ctrl+C regresses on Windows with this, we'd rather get a Bun bug report than keep an ffi workaround here.

How did you verify your code works?

Read-through only (Bun's Source__setRawModeStdin → libuv uv_tty_set_mode flags, opentui renderer.ts raw-mode calls). Not run on Windows — needs someone with a Windows box to confirm Ctrl+C still clears the prompt / exits.

Screenshots / recordings

n/a

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Aug 20, 2026
@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • Not all checklist items are checked. Please confirm you have tested locally and have not included unrelated changes.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

Copy link
Copy Markdown
Contributor

Hey! Your PR title tui: use bun:ffi "buffer" arg type instead of ptr() doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@Jarred-Sumner Jarred-Sumner changed the title tui: use bun:ffi "buffer" arg type instead of ptr() tui: use bun:ffi "buffer" args instead of "ptr" Aug 20, 2026
@Jarred-Sumner
Jarred-Sumner force-pushed the claude/ffi-buffer-args branch from 4107790 to 1b870ae Compare August 20, 2026 08:42
@Jarred-Sumner Jarred-Sumner changed the title tui: use bun:ffi "buffer" args instead of "ptr" tui: remove the win32 ENABLE_PROCESSED_INPUT ffi shim Aug 20, 2026
@Hona
Hona enabled auto-merge (squash) August 20, 2026 08:58
@Hona
Hona merged commit d662539 into anomalyco:v2 Aug 20, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs:compliance This means the issue will auto-close after 2 hours. needs:title

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants