From 58bcd76bfdb76ecbb8cfee868dabe60b43f16cc6 Mon Sep 17 00:00:00 2001 From: Ogulcan Celik Date: Mon, 25 May 2026 18:39:44 +0300 Subject: feat: make focus-gain redraw configurable refs #282 --- src/config/model.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/config') diff --git a/src/config/model.rs b/src/config/model.rs index 35b08582..7434c924 100644 --- a/src/config/model.rs +++ b/src/config/model.rs @@ -259,6 +259,8 @@ pub struct UiConfig { pub sidebar_max_width: u16, /// Capture mouse input for Herdr's mouse UI. Default: true. pub mouse_capture: bool, + /// Force a full host-terminal redraw when the outer terminal regains focus. Default: true. + pub redraw_on_focus_gained: bool, /// Lines to scroll per mouse wheel notch. Default: 3. pub mouse_scroll_lines: Option, /// Ask for confirmation before closing a workspace. Default: true. @@ -416,6 +418,7 @@ impl Default for UiConfig { sidebar_min_width: 18, sidebar_max_width: 36, mouse_capture: true, + redraw_on_focus_gained: true, mouse_scroll_lines: None, confirm_close: true, prompt_new_tab_name: true, @@ -669,6 +672,19 @@ mouse_capture = false assert!(!config.ui.mouse_capture); } + #[test] + fn redraw_on_focus_gained_default_on_and_parse() { + let default_config = Config::default(); + assert!(default_config.ui.redraw_on_focus_gained); + + let toml = r#" +[ui] +redraw_on_focus_gained = false +"#; + let config: Config = toml::from_str(toml).unwrap(); + assert!(!config.ui.redraw_on_focus_gained); + } + #[test] fn mouse_scroll_lines_defaults_to_three_and_parses() { let default_config = Config::default(); -- cgit v1.2.3