mirror of
https://github.com/nyakang/nyaterm.git
synced 2026-10-04 00:00:53 +00:00
f0655b59c19fa00c6cee76d12de1ddf28fc55832
Every "input" in the app is a label div: a `div` that takes focus, swallows key events and prints the draft string. There is no caret, no selection, no pointer positioning and no composition, so the moment anyone tries to edit rather than append it reads as broken — which is exactly the complaint about the filter box. `TextField` is a real GPUI widget instead. It is an `Entity` that owns its buffer and focus, implements `EntityInputHandler` so the platform routes IME and clipboard through it, and paints through a custom `Element` that shapes the line once and reuses that shaping for hit-testing, the selection quads and the caret. Owners learn about edits by subscribing to `TextFieldEvent::Changed`, which carries the new content, rather than reading back through the entity. It deliberately does not claim Enter, Escape, Tab or the arrows: those are dialog and list gestures, so they stay unconsumed for the owner's own key handler. That is what lets the saved-connections filter keep driving result navigation while the field handles the text. The editing rules live in `nyaterm_core::TextEdit` — caret motion across multi-byte boundaries, what counts as a word (hosts and paths make `.`, `-`, `/` and `@` stops), and which end of a selection shift moves — so they are testable without a window. Adopting it in the filter box retires the placeholder caret drawn by splicing a `|` into the display string, and the seven arms this panel had bolted onto `NyaTermApp`'s `EntityInputHandler`; the widget owns its own composition now.
Languages
TypeScript
51.2%
Rust
47%
JavaScript
0.7%
CSS
0.5%
PowerShell
0.3%
Other
0.2%