[PR #801] [MERGED] paste: carry raw bytes instead of decoded text #1573

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

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opentui/pull/801
Author: @simonklee
Created: 3/11/2026
Status: Merged
Merged: 3/13/2026
Merged by: @kommander

Base: mainHead: paste-event


📝 Commits (4)

  • 0a355c0 paste: carry raw bytes instead of decoded text
  • 63dbbae docs
  • ffb4faf deduplicate test helper
  • c4be7d4 Merge branch 'main' into paste-event

📊 Changes

21 files changed (+202 additions, -92 deletions)

View changed files

📝 packages/core/src/examples/keypress-debug-demo.ts (+14 -5)
📝 packages/core/src/lib/KeyHandler.stopPropagation.test.ts (+2 -1)
📝 packages/core/src/lib/KeyHandler.test.ts (+26 -24)
📝 packages/core/src/lib/KeyHandler.ts (+9 -6)
📝 packages/core/src/lib/index.ts (+1 -0)
packages/core/src/lib/paste.ts (+16 -0)
📝 packages/core/src/lib/stdin-parser.test.ts (+20 -4)
📝 packages/core/src/lib/stdin-parser.ts (+37 -22)
📝 packages/core/src/renderables/Input.test.ts (+14 -1)
📝 packages/core/src/renderables/Input.ts (+2 -1)
📝 packages/core/src/renderables/Textarea.ts (+4 -3)
📝 packages/core/src/renderables/__tests__/Textarea.paste.test.ts (+20 -5)
📝 packages/core/src/renderer.ts (+1 -1)
📝 packages/core/src/testing/mock-keys.ts (+5 -0)
📝 packages/core/src/tests/renderable.test.ts (+3 -2)
📝 packages/core/src/tests/renderer.input.test.ts (+6 -5)
📝 packages/solid/examples/components/input-demo.tsx (+1 -1)
📝 packages/solid/tests/events.test.tsx (+8 -5)
📝 packages/web/src/content/docs/bindings/solid.mdx (+3 -1)
📝 packages/web/src/content/docs/core-concepts/keyboard.mdx (+7 -4)

...and 1 more files

📄 Description

PasteEvent carried a decoded, ANSI-stripped string which prevented
consumers from accessing the original bytes. Store a raw Uint8Array
instead and let each consumer (Textarea, Input) decide how to
decode and sanitize. This preserves binary paste content and enables
downstream libraries to implement their own understanding of the
clipboard data.

This is the refactor required for enabling us to implement the same thing https://github.com/anomalyco/opentui/pull/520 tried to add.


🔄 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/801 **Author:** [@simonklee](https://github.com/simonklee) **Created:** 3/11/2026 **Status:** ✅ Merged **Merged:** 3/13/2026 **Merged by:** [@kommander](https://github.com/kommander) **Base:** `main` ← **Head:** `paste-event` --- ### 📝 Commits (4) - [`0a355c0`](https://github.com/anomalyco/opentui/commit/0a355c0405de6ad93a761aa782c555a72a4acccf) paste: carry raw bytes instead of decoded text - [`63dbbae`](https://github.com/anomalyco/opentui/commit/63dbbaef07c4a0256cec66eb4915e72724c71f81) docs - [`ffb4faf`](https://github.com/anomalyco/opentui/commit/ffb4faf82aec621edebdc0e7e8a0a89d5b21f22d) deduplicate test helper - [`c4be7d4`](https://github.com/anomalyco/opentui/commit/c4be7d4f333db08b4fc8e546beee4eaec7bd1ee0) Merge branch 'main' into paste-event ### 📊 Changes **21 files changed** (+202 additions, -92 deletions) <details> <summary>View changed files</summary> 📝 `packages/core/src/examples/keypress-debug-demo.ts` (+14 -5) 📝 `packages/core/src/lib/KeyHandler.stopPropagation.test.ts` (+2 -1) 📝 `packages/core/src/lib/KeyHandler.test.ts` (+26 -24) 📝 `packages/core/src/lib/KeyHandler.ts` (+9 -6) 📝 `packages/core/src/lib/index.ts` (+1 -0) ➕ `packages/core/src/lib/paste.ts` (+16 -0) 📝 `packages/core/src/lib/stdin-parser.test.ts` (+20 -4) 📝 `packages/core/src/lib/stdin-parser.ts` (+37 -22) 📝 `packages/core/src/renderables/Input.test.ts` (+14 -1) 📝 `packages/core/src/renderables/Input.ts` (+2 -1) 📝 `packages/core/src/renderables/Textarea.ts` (+4 -3) 📝 `packages/core/src/renderables/__tests__/Textarea.paste.test.ts` (+20 -5) 📝 `packages/core/src/renderer.ts` (+1 -1) 📝 `packages/core/src/testing/mock-keys.ts` (+5 -0) 📝 `packages/core/src/tests/renderable.test.ts` (+3 -2) 📝 `packages/core/src/tests/renderer.input.test.ts` (+6 -5) 📝 `packages/solid/examples/components/input-demo.tsx` (+1 -1) 📝 `packages/solid/tests/events.test.tsx` (+8 -5) 📝 `packages/web/src/content/docs/bindings/solid.mdx` (+3 -1) 📝 `packages/web/src/content/docs/core-concepts/keyboard.mdx` (+7 -4) _...and 1 more files_ </details> ### 📄 Description PasteEvent carried a decoded, ANSI-stripped string which prevented consumers from accessing the original bytes. Store a raw Uint8Array instead and let each consumer (Textarea, Input) decide how to decode and sanitize. This preserves binary paste content and enables downstream libraries to implement their own understanding of the clipboard data. This is the refactor required for enabling us to implement the same thing https://github.com/anomalyco/opentui/pull/520 tried to add. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-14 09:44:06 +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#1573
No description provided.