mirror of
https://github.com/anomalyco/opentui.git
synced 2026-04-24 20:45:56 +03:00
[PR #686] fix: discard partial OSC/DCS/APC sequences on flush to prevent garbage text in input #713
Labels
No labels
bug
core
documentation
feature
good first issue
help wanted
pull-request
question
react
solid
tmux
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/opentui#713
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/anomalyco/opentui/pull/686
Author: @bbartels
Created: 2/13/2026
Status: 🔄 Open
Base:
main← Head:patch-1📝 Commits (2)
6c20852Update stdin-buffer.tsea53e11Add tests for OSC sequence handling in stdin buffer📊 Changes
2 files changed (+145 additions, -0 deletions)
View changed files
📝
packages/core/src/lib/stdin-buffer.test.ts(+120 -0)📝
packages/core/src/lib/stdin-buffer.ts(+25 -0)📄 Description
Summary
Fixes https://github.com/anomalyco/opencode/issues/6147 — Windows Terminal sends unsolicited OSC queries (10/11/4) over SSH whose responses can arrive fragmented and leak into the TUI input field as garbage text like
eeee/eeee/eeee.Problem
When data arrives fragmented over SSH, the
StdinBuffertimeout can fire mid-sequence. Theflush()method emits the incomplete buffer as-is, which downstreamparseKeypress()no longer recognizes as an escape sequence (since it may be missing theESC ]prefix after the first chunk timed out separately). The payload then gets interpreted as regular text input.Fix
Added
isPartialEscapeSequence()check inflush()that silently discards incomplete OSC (ESC ]), DCS (ESC P), and APC (ESC _) sequences instead of emitting them as input. These sequence types are never valid keypresses.CSI (
ESC [) and SS3 (ESC O) are intentionally not discarded because a timed-outESC [could be a legitimateAlt+[keypress.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.