Skip to content

Commit ceeb6b2

Browse files
A Dynamic Collection of Shell Scripts with Educational Purpose
1 parent da040f6 commit ceeb6b2

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

scripts/ble-simple

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,14 @@ _gt_overlay() {
524524
local cursor_col=$(( ( _CS_PS1_LEN + _CS_POS ) % _term_cols + 1 ))
525525

526526
if [[ -n "$TERMUX_VERSION" ]]; then
527-
# No Termux \e[s/\e[u causam loop — desenha ghost e reposiciona cursor explicitamente
527+
local ghost_len=$(( ${#_GT_SUGGESTION} - ${#line} ))
528+
local content_len=$(( _CS_PS1_LEN + ${#line} ))
529+
local available=$(( _term_cols - ( content_len % _term_cols ) ))
530+
# Se o ghost ultrapassa a linha, não desenha para evitar loop
531+
if [[ -n "$ghost" ]] && (( ghost_len > available )); then
532+
printf '\e[%dG' "$cursor_col" >&2
533+
return
534+
fi
528535
if [[ -z "$ghost" ]]; then
529536
printf '\e[%dG\e[K\e[%dG' "$col" "$cursor_col" >&2
530537
else

0 commit comments

Comments
 (0)