Skip to content

Commit b54e6cc

Browse files
A Dynamic Collection of Shell Scripts with Educational Purpose
1 parent 653aba4 commit b54e6cc

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

scripts/ble-simple

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -613,15 +613,12 @@ _cs_redraw() {
613613
# Calcula quantas linhas o conteúdo anterior pode ter ocupado
614614
local _term_cols; _term_cols=$(tput cols 2>/dev/null || printf '80')
615615
local _total_len=$(( _CS_PS1_LEN + _CS_PREV_BUF_LEN ))
616-
local _prev_lines=$(( (_total_len + _term_cols - 1) / _term_cols ))
617-
(( _prev_lines < 1 )) && _prev_lines=1
616+
local _prev_lines=$(( _total_len / _term_cols ))
618617
local _i
619618
for (( _i=0; _i < _prev_lines; _i++ )); do
620619
printf '\e[2K\e[1A' >&2
621620
done
622-
printf '\e[2K\r' >&2
623-
printf '%s' "$_CS_PS1_UPPER" >&2
624-
printf '%s%s' "$_CS_PS1_LAST" "$colored" >&2
621+
printf '\e[2K\r%s%s' "$_CS_PS1_LAST" "$colored" >&2
625622
printf '\r\e[%dG' "$(( ( _CS_PS1_LEN + _CS_POS ) % _term_cols + 1 ))" >&2
626623
_CS_PREV_BUF_LEN=${#_CS_BUFFER}
627624
fi

0 commit comments

Comments
 (0)