From 57d537621173dcdb82098798a179b513e3179a0d Mon Sep 17 00:00:00 2001 From: nandithebull Date: Tue, 24 Nov 2026 20:21:46 -0800 Subject: [PATCH] Fix launcher search: key_name returned code-unit numbers instead of characters String indexing yields a UTF-16 code unit, so 'a' became "97" and the launcher rejected it. Convert to Char first; the input test now types into the search. Co-Authored-By: Claude Sonnet 5.5 --- compositor/host/compositor.mbt | 2 +- compositor/host/input_test.mbt | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/compositor/host/compositor.mbt b/compositor/host/compositor.mbt index 9ac7f47..d8be9b5 100644 --- a/compositor/host/compositor.mbt +++ b/compositor/host/compositor.mbt @@ -406,7 +406,7 @@ fn key_name(code : UInt, shift : Bool) -> String { for r in rows { let (first, chars) = r if code >= first && code < first + chars.length().reinterpret_as_uint() { - let c = chars[(code - first).reinterpret_as_int()] + let c = Int::unsafe_to_char(chars[(code - first).reinterpret_as_int()].to_int()) return if shift && c >= 'a' && c <= 'z' { Int::unsafe_to_char(c.to_int() - 32).to_string() } else { diff --git a/compositor/host/input_test.mbt b/compositor/host/input_test.mbt index 3c8315e..74187b3 100644 --- a/compositor/host/input_test.mbt +++ b/compositor/host/input_test.mbt @@ -105,6 +105,12 @@ test "host input reaches the focused client and the launcher popup opens" { comp.handle_input(@nested.InputEvent::Key(30U, true), 23U) let after = drain_msgs(c) assert_false(has_msg(after, kbd_id, 3U)) // swallowed by the launcher + // Typing fills the search field: evdev 20 = t, 18 = e (key 30 = a was typed above). + comp.handle_input(@nested.InputEvent::Key(20U, true), 26U) + comp.handle_input(@nested.InputEvent::Key(18U, true), 27U) + assert_eq(comp.shell.launcher_state.query, "ate") + comp.handle_input(@nested.InputEvent::Key(14U, true), 28U) + assert_eq(comp.shell.launcher_state.query, "at") // Off the shell and off any window: default arrow. comp.handle_input(@nested.InputEvent::PointerMove(1270.0, 5.0), 25U) assert_eq(comp.desired_cursor(), 1U)