Handling textual input is an extremely common requirement in user interfaces—especially in terminal UIs, which are inherently text-based—and getting it right is complex. Because of this, I believe TermUi should include native text input components. Here’s my initial vision for how they might work:
📝 Core Features (MVP)
🔧 Post-MVP (Can Wait)
🌟 Nice-to-Haves
📚 Requirements & Dependencies
I’m aiming for a lean subset of the web’s text APIs:
⚠️ Potential Roadblocks
- Shortcuts
Terminal clients often capture common clipboard keys (Cmd+C/Cmd+V or Ctrl+C/Ctrl+V) for their own commands, so TermUi may not receive them. We’ll need to pick alternatives or find workarounds, and make it the least confusing possible.
Handling textual input is an extremely common requirement in user interfaces—especially in terminal UIs, which are inherently text-based—and getting it right is complex. Because of this, I believe TermUi should include native text input components. Here’s my initial vision for how they might work:
📝 Core Features (MVP)
Range selection & actions
Standard shortcuts
Cmd+C/Cmd+V(orCtrl+C/Ctrl+Von other platforms),Cmd+Afor select-all, etc.Cursor movement
Quick navigation
Cmd+↑to jump to the first line,Cmd+←to go to the beginning of the lineOverflow handling
🔧 Post-MVP (Can Wait)
🌟 Nice-to-Haves
📚 Requirements & Dependencies
I’m aiming for a lean subset of the web’s text APIs:
Range API
Based on the WHATWG spec: https://dom.spec.whatwg.org/#ranges
Selection APIs
Note: browsers support two APIs for text selection:
https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#textFieldSelection)https://www.w3.org/TR/selection-api)I’m considering unifying both (plaintext and DOM) to simplify and support rich text editing via
contenteditable(https://html.spec.whatwg.org/multipage/interaction.html#attr-contenteditable).String handling
text: ArrayList(u8)with aNodeKindoftext. I want to introduce a String primitive with codepoint-based length (e.g., based on Zig’s Unicode support rather than byte count).Terminal clients often capture common clipboard keys (
Cmd+C/Cmd+VorCtrl+C/Ctrl+V) for their own commands, so TermUi may not receive them. We’ll need to pick alternatives or find workarounds, and make it the least confusing possible.