From 79b582f983aa2e2cb39dd81f2821dbd4363bd86c Mon Sep 17 00:00:00 2001 From: Loic Nageleisen Date: Tue, 14 Aug 2012 17:49:55 +0200 Subject: [PATCH] fix blink caused by stty --- bash/prompt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/bash/prompt b/bash/prompt index ddf2a71..22c0837 100644 --- a/bash/prompt +++ b/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