On 6/19/20 7:53 PM, Bryan Henderson wrote:
> I tracked it down to an Ncurses change.
> 
> Bash/readline attempts to move the cursor left by calling Ncurses (libtinfo)
> function 'tputs' with ASCII BS (ctl-H) as the argument.  The function of
> 'tputs' is to write stuff to the terminal with delays added, as required by
> early printing terminals.
> 
> In the past, if TERM were set to something undefined, tputs would go ahead and
> write the BS to the terminal, but in the libtinfo linked to Bash on my Debian
> 10 system, tputs fails (returns failure code without writing anything to the
> terminal) if TERM is set to something undefined.  (It still works if TERM
> isn't defined at all, though).  Bash ignores the failure and continues,
> writing a space to the terminal, followed by another failing call to 'tputs'
> for the final backspace.

This is consistent with what I discovered, which is that tputs does not
call the character output function passed as the third argument at all.

I don't know why the ncurses maintainers changed this in version 6, though
I suspect they had some rationale for it at the time. It looks like a
departure from historical versions of curses/ncurses.

The historical behavior (what readline expects) of tputs is to set the
amount of padding required to 0 if the terminal type is unknown, which
basically makes it an indirect per-character function call. From what I've
seen, it fails only if the string parameter is NULL.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/

Reply via email to