bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Backspace echoed incorrectly with TERM=garbage


From: Chet Ramey
Subject: Re: Backspace echoed incorrectly with TERM=garbage
Date: Sat, 20 Jun 2020 14:25:33 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.8.1

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    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]