diff options
| author | ppggff <pgf00a@gmail.com> | 2026-07-05 08:25:47 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-05 03:25:47 +0300 |
| commit | 2bc1724c2dae72184a5d2ec070e30c70dc519f9b (patch) | |
| tree | 573a960e82f832455d303ca97ea1783587482ad6 /tests | |
| parent | e713949ca51facf1e40c584b271f812f527bc522 (diff) | |
fix: switch prefix ASCII input source on the foreground client (#1016)
* fix: switch prefix ASCII input source on the foreground client
The macOS prefix ASCII-switch ran in the headless server, whose
TISCopyCurrentKeyboardInputSource read is a stale per-process cache
(refreshed only via a main-run-loop notification the server never pumps),
so prefix could leave the terminal on the wrong input source.
Forward it to the foreground client, like clipboard: sync_prefix_input_source
emits AppEvent::PrefixInputSource as an intent; the server forwards it to the
foreground client and the monolithic app applies it in-process via
RealPrefixInputSource, which pumps its main run loop before the stale TIS read.
Key it on Mode::wants_ascii_input so multi-level prefix commands keep ASCII
until returning to the terminal, and restore the IME for rename text entry.
Adds ServerMessage::PrefixInputSource to the already-unreleased protocol 15.
refs #774
* fix: keep prefix input-source switch out of the headless server process
An App-internal drain (the exhaustive drain at the top of
handle_api_request, reachable from prefix-key runtime mutations) can
consume a queued PrefixInputSource intent before the server's
forwarding drain sees it, applying the TIS switch in the headless
server process and stranding the restore state. Gate the in-process
switch on App.local_input_source_switch, disabled by the headless
server alongside the other local side effects, so a swallowed intent
degrades to a skipped switch. Widen the forwarding-bypass maintenance
test to the handle_internal_event_with_prefix_sync wrapper.
refs #774
* docs: clarify prefix input-source comments and flag docs
refs #774
* fix: bump protocol for prefix input source
refs #774
---------
Co-authored-by: Ogulcan Celik <ogulcancelik@gmail.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/api_ping.rs | 2 | ||||
| -rw-r--r-- | tests/cli_wrapper.rs | 12 | ||||
| -rw-r--r-- | tests/support/mod.rs | 2 |
3 files changed, 8 insertions, 8 deletions
diff --git a/tests/api_ping.rs b/tests/api_ping.rs index 1d625637..24204548 100644 --- a/tests/api_ping.rs +++ b/tests/api_ping.rs @@ -304,7 +304,7 @@ fn ping_over_socket_returns_version() { assert_eq!(value["result"]["version"], env!("CARGO_PKG_VERSION")); // Intentionally hardcoded so wire protocol bumps require updating this test. // Changing this value means old clients/servers are no longer compatible. - assert_eq!(value["result"]["protocol"], 15); + assert_eq!(value["result"]["protocol"], 16); cleanup_spawned_herdr(child, base); } diff --git a/tests/cli_wrapper.rs b/tests/cli_wrapper.rs index d3f67780..eac0b376 100644 --- a/tests/cli_wrapper.rs +++ b/tests/cli_wrapper.rs @@ -1620,7 +1620,7 @@ fn status_commands_report_client_and_server_versions() { "stdout: {full_stdout}" ); assert!( - full_stdout.contains(" protocol: 15"), + full_stdout.contains(" protocol: 16"), "stdout: {full_stdout}" ); assert!(full_stdout.contains("server:\n"), "stdout: {full_stdout}"); @@ -1653,7 +1653,7 @@ fn status_commands_report_client_and_server_versions() { "stdout: {server_stdout}" ); assert!( - server_stdout.contains("protocol: 15"), + server_stdout.contains("protocol: 16"), "stdout: {server_stdout}" ); @@ -1665,7 +1665,7 @@ fn status_commands_report_client_and_server_versions() { "stdout: {client_stdout}" ); assert!( - client_stdout.contains("protocol: 15"), + client_stdout.contains("protocol: 16"), "stdout: {client_stdout}" ); assert!( @@ -1675,7 +1675,7 @@ fn status_commands_report_client_and_server_versions() { let full_json = run_cli_json(&socket_path, &["status", "--json"]); assert_eq!(full_json["client"]["version"], env!("CARGO_PKG_VERSION")); - assert_eq!(full_json["client"]["protocol"], 15); + assert_eq!(full_json["client"]["protocol"], 16); assert_eq!(full_json["server"]["status"], "running"); assert_eq!(full_json["server"]["running"], true); assert_eq!(full_json["server"]["compatible"], true); @@ -1689,12 +1689,12 @@ fn status_commands_report_client_and_server_versions() { let server_json = run_cli_json(&socket_path, &["status", "server", "--json"]); assert_eq!(server_json["status"], "running"); assert_eq!(server_json["version"], env!("CARGO_PKG_VERSION")); - assert_eq!(server_json["protocol"], 15); + assert_eq!(server_json["protocol"], 16); assert_eq!(server_json["compatible"], true); let client_json = run_cli_json(&socket_path, &["status", "client", "--json"]); assert_eq!(client_json["version"], env!("CARGO_PKG_VERSION")); - assert_eq!(client_json["protocol"], 15); + assert_eq!(client_json["protocol"], 16); assert!(client_json["binary"] .as_str() .is_some_and(|path| !path.is_empty())); diff --git a/tests/support/mod.rs b/tests/support/mod.rs index 5844bfa7..e4a9139a 100644 --- a/tests/support/mod.rs +++ b/tests/support/mod.rs @@ -15,7 +15,7 @@ static INIT: Once = Once::new(); static CLEANUP_GUARD: OnceLock<CleanupGuard> = OnceLock::new(); const WATCHDOG_SCAN_INTERVAL: Duration = Duration::from_secs(1); const RUNTIME_OWNER_MARKER: &str = ".herdr-test-owner-pid"; -pub const CURRENT_PROTOCOL: u32 = 15; +pub const CURRENT_PROTOCOL: u32 = 16; pub fn register_spawned_herdr_pid(pid: Option<u32>) { let Some(pid) = pid else { |
