File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -519,14 +519,23 @@ _gt_overlay() {
519519 ghost=" ${_gt_gh}${_GT_SUGGESTION: ${# line} }${_gt_b0} "
520520 fi
521521
522- printf ' OVERLAY line="%s" ghost="%s" col=%s\n' \
523- " $line " " ${ghost: 0: 20} " " $(( _CS_PS1 _LEN + ${# line} + 1 )) " >> " ${TMPDIR} /cs_debug.log"
524-
522+ local _term_cols; _term_cols=$( tput cols 2> /dev/null || printf ' 80' )
525523 local col=$(( _CS_PS1 _LEN + ${# line} + 1 ))
526- if [[ -z " $ghost " ]]; then
527- printf ' \e[s\e[%dG\e[K\e[u' " $col " >&2
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
528+ if [[ -z " $ghost " ]]; then
529+ printf ' \e[%dG\e[K\e[%dG' " $col " " $cursor_col " >&2
530+ else
531+ printf ' \e[%dG\e[K%s\e[%dG' " $col " " $ghost " " $cursor_col " >&2
532+ fi
528533 else
529- printf ' \e[s\e[%dG\e[K%s\e[u' " $col " " $ghost " >&2
534+ if [[ -z " $ghost " ]]; then
535+ printf ' \e[s\e[%dG\e[K\e[u' " $col " >&2
536+ else
537+ printf ' \e[s\e[%dG\e[K%s\e[u' " $col " " $ghost " >&2
538+ fi
530539 fi
531540}
532541
You can’t perform that action at this time.
0 commit comments