Files
faumarayandClaude Opus 5.5 c81d4ea666 spikes/gpui/composer: spike 2, the composer, preedit and chat lines
gpui-component's Textarea as the composer (auto-grow, placeholder), emoji
from a picker of voelin-ui-vm's emoji archive inserted at the caret,
pictures and file paths pasted as attachments (Textarea::on_paste),
Ctrl+Enter bound to Send in the Input context after gpui-component's own
bindings. Sample messages go through voelin_ui_vm::chat::line and are drawn
as StyledText with one GPUI text run per TextRun inside InteractiveText,
links clickable (masked ones ask first). The preedit is GPUI's own (XIM on
X11, text-input-v3 on Wayland); the spike reads the marked range and
prints it. drive.sh runs the scenario on the headless display, ime.sh the
X11 preedit with fcitx5 and Pinyin.

From the interrupted attempt, changed here: runs instead of highlights, so
each run has its font (emoji runs in Noto Color Emoji, code in the theme's
monospace font: the row's font_family("monospace") resolved to no
monospace font); a sample line of the smileys DejaVu Sans also has; the
picker in the emoji font; the font probe (whose get_font_for_id printed
"?" for every fallback font) replaced by an emoji probe that counts the
glyphs GPUI draws in colour (ShapedGlyph::is_emoji), printed by drive.sh as
findings for the system's and a Noto-only font configuration.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 01:43:43 +03:00
..

Spike 2: composer, IME and chat lines

spike-composer is a chat view with a composer:

  • Lines. Sample messages in BBCode go through voelin-ui-vm (chat::line: bbcode → TextBlocks of TextRuns, read only) and are drawn as StyledText with one GPUI text run per TextRun (its font: Inter, the theme's monospace font for code, Noto Color Emoji for the runs marked as emoji; bold, italic, underline, strike, code background, the author colour ink_dark) inside InteractiveText, whose clickable ranges are the runs with a link (a click prints the link and whether it is masked, which asks first). Quotes, code blocks, list items and rules are blocks; one to three emoji alone are large (ChatLine.jumbo). Emoji are characters drawn by a colour emoji font (TextRun.emoji, the Twemoji key, only says that a run is one).
  • Emoji probe. At start the spike lays out three lines of emoji the way the list draws them, once with the emoji runs in Noto Color Emoji and once in Inter with its fallback chain, and prints how many glyphs GPUI draws in colour (ShapedGlyph::is_emoji).
  • Composer. gpui-component's Textarea (TextareaState, auto-grow 1 to 6 rows). The emoji button opens a picker of the first 96 emoji of voelin_ui_vm::emoji::archive().category(0) (the names and characters of the client's picker); a click inserts at the caret (TextareaState::insert) and gives the focus back. Ctrl+Enter sends (bound to a Send action in the Input context after gpui-component's own bindings, so its "secondary enter" newline is not inserted first). Textarea::on_paste takes pictures (ClipboardEntry::Image), files (ExternalPaths) and text that is the absolute path of an existing file as attachments; other text is pasted.
  • Preedit. Nothing in the app: GPUI's platform input handler and gpui-component's marked text. The spike reads the marked range ten times a second and prints it.

Reproducing

spikes/gpui/shell.sh sh -c 'cd spikes/gpui && cargo build --locked --release'
# the sample list, the picker, typing, emoji at the caret, Ctrl+Enter,
# picture and path paste, a link click: eight checks and the emoji probe's
# findings, screenshots in $OUT
spikes/gpui/shell.sh spikes/gpui/headless.sh -- spikes/gpui/composer/drive.sh
# X11 preedit: fcitx5 + Pinyin as the XIM server (on-the-spot), "nihao",
# Space, Ctrl+Enter: three checks, screenshots of the preedit
spikes/gpui/shell.sh spikes/gpui/headless.sh -- spikes/gpui/composer/ime.sh

drive.sh first opens the window once with a font configuration of only Noto Color Emoji, Noto Sans CJK and Cantarell (FONTCONFIG_FILE), then with the system's: the two screenshots and the probe's two lines show the colour emoji finding in docs/design/gpui-spikes.md.