functions/history: honor explicitly specified --color=

This partially reverts 324223ddff.

The offending commit broke the ability to set color mode via option
completely in interactive sessions.

Closes #12511
This commit is contained in:
Mike Yuan
2026-03-05 19:51:58 +01:00
committed by Johannes Altmanninger
parent 6f262afe8e
commit cbd5d7640a

View File

@@ -90,7 +90,11 @@ function history --description "display or manipulate interactive command histor
not set -qx LV # ask the pager lv not to strip colors
and set -fx LV -c
builtin history search --color=always $search_mode $show_time $max_count $_flag_case_sensitive $_flag_reverse $_flag_null -- $argv | $pager
if not set -q color_opt[1]
set color_opt --color=always
end
builtin history search $color_opt $search_mode $show_time $max_count $_flag_case_sensitive $_flag_reverse $_flag_null -- $argv | $pager
else
builtin history search $color_opt $search_mode $show_time $max_count $_flag_case_sensitive $_flag_reverse $_flag_null -- $argv
end