Files
fish-shell/share/functions/__fish_echo.fish
Xiretza b7fabb11ac Make command run by __fish_echo output to TTY for color detection
Without this, e.g. Alt-L shows the directory entries one per line and
without colors.

Closes #11888
2025-10-06 13:39:30 +02:00

19 lines
619 B
Fish

# localization: skip(private)
set -l erase_line "$(
if status test-feature ignore-terminfo
echo \e\[K
else if type -q tput
tput el
end
)"
function __fish_echo --inherit-variable erase_line --description 'run the given command after the current commandline and redraw the prompt'
set -l line (commandline --line)
string >&2 repeat -N \n --count=(math (commandline | count) - $line + 1)
printf %s $erase_line >&2
$argv >&2
string >&2 repeat -N \n --count=(math (count (fish_prompt)) - 1)
string >&2 repeat -N \n --count=(math $line - 1)
commandline -f repaint
end