mirror of
https://github.com/lloeki/dotfiles.git
synced 2025-12-06 07:24:39 +01:00
fix blink caused by stty
This commit is contained in:
parent
819fd72a82
commit
79b582f983
1 changed files with 5 additions and 6 deletions
11
bash/prompt
11
bash/prompt
|
|
@ -42,20 +42,19 @@ __tpwd() {
|
|||
}
|
||||
|
||||
clear_incomplete_line() {
|
||||
# prevent the terminal response to be displayed
|
||||
stty raw -echo
|
||||
# ask for cursor position
|
||||
echo -en "\033[6n"
|
||||
# read answer
|
||||
IFS=';' read -r -d R -a pos
|
||||
# set back terminal to human mode
|
||||
stty -raw echo
|
||||
# extract tput-compatible answer
|
||||
local row=$((${pos[0]:2} - 1))
|
||||
local col=$((${pos[1]} - 1))
|
||||
# move back over terminal answer echo, which will hopefully be overwritten
|
||||
tput cup $row $col
|
||||
|
||||
# not on first column? clean up!
|
||||
[[ $col != 0 ]] && printf "\e[7m%%\e[m\n"
|
||||
# not on first column? clean up! (overwrites answer)
|
||||
[[ $col != 0 ]] && printf "\e[7m%%\e[m%$((COLUMNS-1))s\r"
|
||||
# else e.g prompt will overwrite answer echo
|
||||
}
|
||||
|
||||
# git prompt info
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue