[PR #648] [MERGED] Fix double escape #1463

Closed
opened 2026-03-14 09:38:11 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opentui/pull/648
Author: @simonklee
Created: 2/8/2026
Status: Merged
Merged: 2/8/2026
Merged by: @kommander

Base: mainHead: fix-double-escape


📝 Commits (2)

  • a2ae92c test(stdin-buffer): add tests for double-escape sequence handling
  • eb1fc02 fix(stdin-buffer): handle double-escape sequences in input parsing

📊 Changes

2 files changed (+72 additions, -0 deletions)

View changed files

📝 packages/core/src/lib/stdin-buffer.test.ts (+49 -0)
📝 packages/core/src/lib/stdin-buffer.ts (+23 -0)

📄 Description

Recognize ESC ESC prefix sequences (e.g. Option+Arrow keys in iTerm2) by
recursively checking completeness after stripping the leading ESC. When
buffering incomplete input, emit a bare ESC ESC as its own sequence unless
followed by a valid nested escape introducer like [, O, etc.

Fix #644


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opentui/pull/648 **Author:** [@simonklee](https://github.com/simonklee) **Created:** 2/8/2026 **Status:** ✅ Merged **Merged:** 2/8/2026 **Merged by:** [@kommander](https://github.com/kommander) **Base:** `main` ← **Head:** `fix-double-escape` --- ### 📝 Commits (2) - [`a2ae92c`](https://github.com/anomalyco/opentui/commit/a2ae92c9c2a354716a0439b9302fc398e627b221) test(stdin-buffer): add tests for double-escape sequence handling - [`eb1fc02`](https://github.com/anomalyco/opentui/commit/eb1fc020a61f245158be5363241fc951c4cce7b8) fix(stdin-buffer): handle double-escape sequences in input parsing ### 📊 Changes **2 files changed** (+72 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/core/src/lib/stdin-buffer.test.ts` (+49 -0) 📝 `packages/core/src/lib/stdin-buffer.ts` (+23 -0) </details> ### 📄 Description Recognize ESC ESC prefix sequences (e.g. Option+Arrow keys in iTerm2) by recursively checking completeness after stripping the leading ESC. When buffering incomplete input, emit a bare ESC ESC as its own sequence unless followed by a valid nested escape introducer like `[`, `O`, etc. Fix #644 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-14 09:38:11 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/opentui#1463
No description provided.