On Tue, Jun 02, 2026 at 04:21:54PM -0700, Parke wrote: > Hello, [email protected], > > I am observing that the following two tput commands generate identical output. > > tput el > tput cuu1 el > > Is this expected and intentional? (To me it seems unexpected and surprising.)
no - referring to
20210925
+ modify tput to allow multiple commands per line.
which I documented thus:
While more reliable than System V's utility, a portability problem
is introduced by this analysis. An OpenBSD developer adapted the
internal library function from ncurses to port NetBSD's termcap-
based tput to terminfo, and modified it to interpret multiple cap-
codes (and parameters) on the command line. Portable applications
should not rely upon this feature; ncurses offers it to support ap‐
plications written specifically for OpenBSD.
This seems familiar (as if I recall fixing a regression in this a while back),
but I don't see it in the history.
In a quick check with your script, the results look ok (both with 202050216
which is Debian stable, and current):
xterm-256color
tput cuu1 0000000 1b 5b 41
tput el 0000000 1b 5b 4b
tput cuu1 el 0000000 1b 5b 41 1b 5b 4b
tput cuu1 ; tput el 0000000 1b 5b 41 1b 5b 4b
tput cuu 1 el 0000000 1b 5b 31 41 1b 5b 4b
so... you're either referring to something before 20210925,
or I'm missing something.
> For your convenience, here is a test script:
>
> #! /bin/dash
>
> run_test () {
> local command="{ $1 ; } | od -t x1 | head -n 1"
> local output="$( eval $command )"
> printf '%-30s %s\n' "$1" "$output"
> return ; }
>
> echo "$TERM" # xterm-256color
>
> run_test 'tput cuu1' # 1b 5b 41
> run_test 'tput el' # 1b 5b 4b
> run_test 'tput cuu1 el' # 1b 5b 4b
> run_test 'tput cuu1 ; tput el' # 1b 5b 41 1b 5b 4b
> run_test 'tput cuu 1 el' # 1b 5b 31 41 1b 5b 4b
>
>
--
Thomas E. Dickey <[email protected]>
https://invisible-island.net
signature.asc
Description: PGP signature
