1 parent da040f6 commit ceeb6b2Copy full SHA for ceeb6b2
1 file changed
scripts/ble-simple
@@ -524,7 +524,14 @@ _gt_overlay() {
524
local cursor_col=$(( ( _CS_PS1_LEN + _CS_POS ) % _term_cols + 1 ))
525
526
if [[ -n "$TERMUX_VERSION" ]]; then
527
- # No Termux \e[s/\e[u causam loop — desenha ghost e reposiciona cursor explicitamente
+ 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
535
if [[ -z "$ghost" ]]; then
536
printf '\e[%dG\e[K\e[%dG' "$col" "$cursor_col" >&2
537
else
0 commit comments