diff options
Diffstat (limited to 'src/app')
| -rw-r--r-- | src/app/mod.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/app/mod.rs b/src/app/mod.rs index 713e0b02..c9d54f46 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -122,6 +122,7 @@ pub struct App { pub(crate) next_agent_manifest_update_check: Option<Instant>, pub(crate) update_version_check_enabled: bool, pub(crate) update_manifest_check_enabled: bool, + pub(crate) loaded_host_cursor: crate::config::HostCursorModeConfig, pub(crate) agent_metadata_deadline: Option<Instant>, pub(crate) pending_agent_resume_deadline: Option<Instant>, pub(crate) selection_autoscroll_deadline: Option<Instant>, @@ -710,6 +711,7 @@ impl App { .then_some(Instant::now() + AUTO_UPDATE_CHECK_INTERVAL), update_version_check_enabled: config.update.version_check, update_manifest_check_enabled: config.update.manifest_check, + loaded_host_cursor: config.ui.host_cursor, agent_metadata_deadline: None, pending_agent_resume_deadline: None, session_save_deadline: None, @@ -1356,6 +1358,10 @@ impl App { self.state.request_client_config_reload = true; } self.state.redraw_on_focus_gained = config.ui.redraw_on_focus_gained; + if self.loaded_host_cursor != config.ui.host_cursor { + self.state.request_client_config_reload = true; + } + self.loaded_host_cursor = config.ui.host_cursor; self.state.mouse_scroll_lines = config.ui.mouse_scroll_lines(); self.state.right_click_passthrough_modifiers = config.ui.right_click_passthrough_modifiers(); @@ -2474,6 +2480,30 @@ mod tests { } #[test] + fn reload_config_requests_client_reload_for_host_cursor_only_change() { + let _guard = config_env_lock().lock().unwrap(); + let path = temp_config_path("reload-config-host-cursor"); + std::fs::create_dir_all(path.parent().unwrap()).unwrap(); + std::fs::write(&path, "[ui]\nhost_cursor = \"native\"\n").unwrap(); + std::env::set_var(crate::config::CONFIG_PATH_ENV_VAR, &path); + + let mut app = test_app(); + app.state.request_client_config_reload = false; + + let report = app.reload_config(); + + assert_eq!(report.status, crate::config::ConfigReloadStatus::Applied); + assert_eq!( + app.loaded_host_cursor, + crate::config::HostCursorModeConfig::Native + ); + assert!(app.state.request_client_config_reload); + + std::env::remove_var(crate::config::CONFIG_PATH_ENV_VAR); + let _ = std::fs::remove_dir_all(path.parent().unwrap()); + } + + #[test] fn reload_config_updates_sidebar_width_only_when_config_owned() { let _guard = config_env_lock().lock().unwrap(); let path = temp_config_path("reload-config-sidebar-width"); |
