mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 21:44:16 +00:00
history: drop use of fish_indent
Largely reverts 007d794b6e
.
fish_indent is extremely resource-intensive on large inputs and can crash; it also does not handle
invalid characters gracefully.
Work on #5402.
This commit is contained in:
parent
ffab420e43
commit
79d53a32dc
1 changed files with 5 additions and 13 deletions
|
@ -32,7 +32,6 @@ function history --description "display or manipulate interactive command histor
|
||||||
|
|
||||||
set -l hist_cmd
|
set -l hist_cmd
|
||||||
set -l show_time
|
set -l show_time
|
||||||
set -l skip_indent
|
|
||||||
set -l max_count
|
set -l max_count
|
||||||
set -q _flag_max
|
set -q _flag_max
|
||||||
set max_count -n$_flag_max
|
set max_count -n$_flag_max
|
||||||
|
@ -41,10 +40,6 @@ function history --description "display or manipulate interactive command histor
|
||||||
and set -l _flag_show_time $_flag_with_time
|
and set -l _flag_show_time $_flag_with_time
|
||||||
if set -q _flag_show_time[1]
|
if set -q _flag_show_time[1]
|
||||||
set show_time --show-time=$_flag_show_time
|
set show_time --show-time=$_flag_show_time
|
||||||
# `history -t` by default shows timestamps on seperate lines beginning with # characters.
|
|
||||||
# When colorized the timetamps would highlighted as comments by fish_indent. With a custom
|
|
||||||
# format there is no guarantee fish_indent can do anything useful.
|
|
||||||
set skip_indent true
|
|
||||||
else if set -q _flag_show_time
|
else if set -q _flag_show_time
|
||||||
set show_time --show-time
|
set show_time --show-time
|
||||||
end
|
end
|
||||||
|
@ -93,18 +88,15 @@ function history --description "display or manipulate interactive command histor
|
||||||
and set pager $PAGER
|
and set pager $PAGER
|
||||||
|
|
||||||
# If the user hasn't preconfigured less with the $LESS environment variable,
|
# If the user hasn't preconfigured less with the $LESS environment variable,
|
||||||
# we do so to prevent the stripping of control characters (for color) and have
|
# we do so to have it behave like cat if output fits on one screen. Prevent the
|
||||||
# it behave like cat if output fits on one screen. Prevent the screen from clearing
|
# screen from clearing on quit, so there is something to see if it exits.
|
||||||
# on quit, so there is something to see if it exits.
|
# These are two of the options `git` sets through $LESS before starting the pager.
|
||||||
# These are the same three options `git` sets through $LESS before starting the pager.
|
|
||||||
not set -qx LESS
|
not set -qx LESS
|
||||||
and set -x LESS --RAW-CONTROL-CHARS --quit-if-one-screen --no-init
|
and set -x LESS --quit-if-one-screen --no-init
|
||||||
not set -qx LV # ask the pager lv not to strip colors
|
not set -qx LV # ask the pager lv not to strip colors
|
||||||
and set -x LV -c
|
and set -x LV -c
|
||||||
|
|
||||||
set -q skip_indent[1] # --show-time=FORMAT set, arbitrary output may not be valid fish script
|
builtin history search $search_mode $show_time $max_count $_flag_case_sensitive $_flag_reverse $_flag_null -- $argv | $pager
|
||||||
and builtin history search $search_mode $show_time $max_count $_flag_case_sensitive $_flag_reverse $_flag_null -- $argv | $pager
|
|
||||||
or builtin history search $search_mode $show_time $max_count $_flag_case_sensitive $_flag_reverse $_flag_null -- $argv | fish_indent --ansi | $pager
|
|
||||||
else
|
else
|
||||||
builtin history search $search_mode $show_time $max_count $_flag_case_sensitive $_flag_reverse $_flag_null -- $argv
|
builtin history search $search_mode $show_time $max_count $_flag_case_sensitive $_flag_reverse $_flag_null -- $argv
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue