diff --git a/src/env_dispatch.rs b/src/env_dispatch.rs index 6e9fc515e..80f38618c 100644 --- a/src/env_dispatch.rs +++ b/src/env_dispatch.rs @@ -8,7 +8,8 @@ use crate::prelude::*; use crate::reader::{ reader_change_cursor_end_mode, reader_change_cursor_selection_mode, reader_change_history, - reader_schedule_prompt_repaint, reader_set_autosuggestion_enabled, reader_set_transient_prompt, + reader_current_data, reader_schedule_prompt_repaint, reader_set_autosuggestion_enabled, + reader_set_transient_prompt, }; use crate::screen::{ IS_DUMB, LAYOUT_CACHE_SHARED, ONLY_GRAYSCALE, screen_set_midnight_commander_hack, @@ -215,11 +216,14 @@ pub fn env_dispatch_var_change(key: &wstr, vars: &EnvStack) { dispatch_table.dispatch(key, vars); } - if string_prefixes_string(L!("fish_color_"), key) - // TODO Don't re-exec prompt when only pager color changed. - || string_prefixes_string(L!("fish_pager_color_"), key) - { - reader_schedule_prompt_repaint(); + // TODO(MSRV>=1.88): if-let + if let Some(data) = reader_current_data() { + if string_prefixes_string(L!("fish_color_"), key) || { + // TODO Don't re-exec prompt when only pager color changed. + string_prefixes_string(L!("fish_pager_color_"), key) + } { + data.schedule_prompt_repaint(); + } } } diff --git a/src/reader/reader.rs b/src/reader/reader.rs index cfcaf7666..8d96dc052 100644 --- a/src/reader/reader.rs +++ b/src/reader/reader.rs @@ -1617,7 +1617,7 @@ pub fn mouse_left_click(&mut self, click_position: ViewportPosition) { } } - fn schedule_prompt_repaint(&mut self) { + pub fn schedule_prompt_repaint(&mut self) { if self.force_exec_prompt_and_repaint { return; }