diff --git a/share/functions/__fish_echo.fish b/share/functions/__fish_echo.fish index 94768fbdc..9f0948799 100644 --- a/share/functions/__fish_echo.fish +++ b/share/functions/__fish_echo.fish @@ -1,7 +1,15 @@ -function __fish_echo --description 'run the given command after the current commandline and redraw the prompt' +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) - $argv >&2 + printf %s\n $erase_line($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