mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-28 01:11:15 -03:00
env: check cheaper condition first
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user