Skip to content

Preserve TUI input when terminal focus returns - #35649

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/16e26f81c1343d01f6d0baeff3f204bcc91dd6f3
Jul 27, 2026
Merged

Preserve TUI input when terminal focus returns#35649
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/16e26f81c1343d01f6d0baeff3f204bcc91dd6f3

Conversation

@copyberry

@copyberry copyberry Bot commented Jul 27, 2026

Copy link
Copy Markdown

Preserve TUI input when terminal focus returns

Why

Refreshing the terminal palette on a focus event can block the input loop and
discard keystrokes entered while focus is returning.

What changed

  • Keep the palette cached by the startup probe when handling FocusGained.
  • Continue updating focus state and requesting a redraw without issuing new
    foreground or background color queries.

Testing

  • Verify a queued key is delivered after FocusGained.
  • Exercise focus regain in a pseudo-terminal with immediate and delayed input,
    and verify it emits no additional palette queries.

## Why

Refreshing the terminal palette on a focus event can block the input loop and
discard keystrokes entered while focus is returning.

## What changed

- Keep the palette cached by the startup probe when handling `FocusGained`.
- Continue updating focus state and requesting a redraw without issuing new
  foreground or background color queries.

## Testing

- Verify a queued key is delivered after `FocusGained`.
- Exercise focus regain in a pseudo-terminal with immediate and delayed input,
  and verify it emits no additional palette queries.

GitOrigin-RevId: 16e26f81c1343d01f6d0baeff3f204bcc91dd6f3
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/16e26f81c1343d01f6d0baeff3f204bcc91dd6f3 branch from 15598ea to 976129f Compare July 27, 2026 18:00
@copyberry
copyberry Bot merged commit 976129f into main Jul 27, 2026
14 of 32 checks passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/16e26f81c1343d01f6d0baeff3f204bcc91dd6f3 branch July 27, 2026 18:01
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant