bash: print reverse video % when last line doesn't end in linebreak

This commit is contained in:
buffet 2023-09-15 08:34:04 +02:00
parent 5d99efa152
commit c9e8a47af3

View file

@ -10,8 +10,15 @@ bind '"\e\C-m": "\C-e | nvim\C-m"'
__prompt() { __prompt() {
local status="$?" local status="$?"
local row
local col
PS1='\[\e[0m\e[1m\][' IFS=';' read -rs -dR -p $'\e[6n' row col >/dev/tty
if [[ $col != 1 ]]; then
printf '%s' $'\e[7m%\n\e[0m'
fi
PS1='\[\e[0;1m\]['
case $status in case $status in
0) PS1+='\[\e[36m\]' ;; 0) PS1+='\[\e[36m\]' ;;