Skip to content

Commit 4b55778

Browse files
A Dynamic Collection of Shell Scripts with Educational Purpose
1 parent b54e6cc commit 4b55778

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

scripts/ble-simple

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -614,11 +614,10 @@ _cs_redraw() {
614614
local _term_cols; _term_cols=$(tput cols 2>/dev/null || printf '80')
615615
local _total_len=$(( _CS_PS1_LEN + _CS_PREV_BUF_LEN ))
616616
local _prev_lines=$(( _total_len / _term_cols ))
617-
local _i
618-
for (( _i=0; _i < _prev_lines; _i++ )); do
619-
printf '\e[2K\e[1A' >&2
620-
done
621-
printf '\e[2K\r%s%s' "$_CS_PS1_LAST" "$colored" >&2
617+
if (( _prev_lines > 0 )); then
618+
printf '\e[%dA' "$_prev_lines" >&2
619+
fi
620+
printf '\r\e[J%s%s' "$_CS_PS1_LAST" "$colored" >&2
622621
printf '\r\e[%dG' "$(( ( _CS_PS1_LEN + _CS_POS ) % _term_cols + 1 ))" >&2
623622
_CS_PREV_BUF_LEN=${#_CS_BUFFER}
624623
fi

0 commit comments

Comments
 (0)