Files
Claude 27252a97ab
CI / test (push) Canceled after 0s
Emoji picker (Super+.): search, tabs, skin tones, recents, text-input-v3 insertion
Compositor-drawn Win+. style picker. The focused app keeps keyboard focus so
its text-input-v3 field stays enabled; the emoji goes in with commit_string,
or onto the clipboard with a visible notice when the app has no text field.
Shortcut lives in the shortcut table (rebindable in Settings > Shortcuts).

- compositor/wayland/text_input.mbt: zwp_text_input_manager_v3 (global 12)
- compositor/emoji: Emoji 18.0 + CLDR 49 data (Unicode License), search,
  picker model, CBDT/CBLC + GSUB reader for Noto Color Emoji
- Chandra's own pinned bitmap Noto Color Emoji (scripts/fetch-emoji-font.sh,
  just emoji-font); Fedora's COLRv1 copy can't be drawn. Missing font shows
  an error panel.
- raster WIT: emoji-font, emoji-has, emoji-image; served by wasmhost
- state.edn :emoji {:recent [...] :skin-tone n}
- tests incl. a fake text-input client; docs/emoji-picker.md

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hkABDGJixotaqFv2X2
2026-11-26 07:00:22 +00:00

45 lines
1.6 KiB
MoonBit

///|
test "the data lists every tab, in CLDR order, with skin tone variants" {
let es = @emoji.all()
assert_true(es.length() > 1800)
assert_eq(es[0].text, "😀")
assert_eq(es[0].name, "grinning face")
assert_eq(es[0].tab, 1)
for t = 1; t <= 9; t = t + 1 {
assert_true(es.iter().any(e => e.tab == t))
}
// Tabs come in order.
for i = 1; i < es.length(); i = i + 1 {
assert_true(es[i - 1].tab <= es[i].tab)
}
let (wave, tone) = @emoji.find("👋").unwrap()
assert_eq(tone, 0)
assert_eq(es[wave].toned(3), "👋🏽")
assert_eq(@emoji.find("👋🏿"), Some((wave, 5)))
// An emoji without skin tones stays as it is.
assert_eq(es[0].toned(4), "😀")
// Two people: both get the tone.
let (hands, _) = @emoji.find("🧑‍🤝‍🧑").unwrap()
assert_eq(es[hands].toned(1), "🧑🏻‍🤝‍🧑🏻")
}
///|
test "search: names first, then keywords; every word must match" {
let es = @emoji.all()
let first = fn(q : String) { es[@emoji.search(q)[0]].text }
assert_eq(first("grinning face"), "😀")
assert_eq(first("thumbs up"), "👍")
assert_eq(first(":heart"), "❤️")
assert_eq(first("PIZZA"), "🍕")
// A keyword: "lol" is not in any name.
assert_true(@emoji.search("lol").map(i => es[i].text).contains("😂"))
// Every word has to match something.
assert_eq(@emoji.search("pizza unicorn"), [])
assert_eq(@emoji.search(" "), [])
// Flags by country name.
assert_eq(first("germany"), "🇩🇪")
// A filter leaves emoji out.
let no_pizza = @emoji.search("pizza", keep=i => es[i].text != "🍕")
assert_false(no_pizza.map(i => es[i].text).contains("🍕"))
}