Re: Surprising tput behavior: `tput el` and `tput cuu1 el` generate identical output
Thomas Dickey <[email protected]> Tue, 2 Jun 2026 20:23:57 -0400
| Newsgroups | gmane.comp.lib.ncurses.bugs |
|---|---|
| Message-ID | <[email protected]> |
--MViTSF/MTmerS6va Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jun 02, 2026 at 04:21:54PM -0700, Parke wrote: > Hello, [email protected], >=20 > I am observing that the following two tput commands generate identical ou= tput. >=20 > tput el > tput cuu1 el >=20 > Is this expected and intentional? (To me it seems unexpected and surpris= ing.) 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 pro= blem is introduced by this analysis. An OpenBSD developer adapted = the internal library function from ncurses to port NetBSD's term= cap- based tput to terminfo, and modified it to interpret multiple = cap- codes (and parameters) on the command line. Portable applicat= ions should not rely upon this feature; ncurses offers it to support = ap=E2=80=90 plications written specifically for OpenBSD. =20 This seems familiar (as if I recall fixing a regression in this a while bac= k), 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: >=20 > #! /bin/dash >=20 > run_test () { > local command=3D"{ $1 ; } | od -t x1 | head -n 1" > local output=3D"$( eval $command )" > printf '%-30s %s\n' "$1" "$output" > return ; } >=20 > echo "$TERM" # xterm-256color >=20 > 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 >=20 >=20 --=20 Thomas E. Dickey <[email protected]> https://invisible-island.net --MViTSF/MTmerS6va Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGYgtkt2kxADCLA1WzCr0RyFnvgMFAmofdBkACgkQzCr0RyFn vgNznwv5AWOEmuqJvNnn1MwZ1I/mYXRlYtLwsDnm/d7kuCYWnTJDDmvC+C5Iayvy V0o+LpftgHSfx2tIyLckIA6VfxCqoKOCMsoM2YtoDDaBTyPc7ZO7HFLFnTERb4vv oo621Z2CIsXikcIRtQsHEZvU1ctnUxHLy8pbzol2w8Njf80Pm311zhIE9Q5fnLjp PdYrM9VliSkWRLZ0PCpp5JiinVCewsmOwIYQ64sqJ2CPxci7WzWZd6vUqjMXVv/q czd+xX04cnwm8etOBBjar6SVSd6GKWnPIpTMBBhy8qz4zh4FHdNXvjBvAAfKGrr5 ywxne1UETlKcLNVebZfp50Wcv5yW+YBDuGvqHJl5r4/ZP7JYIm08SnZXrhX8t99D NpiARl+ilJVU/YgbbPnlWkdzVksNsl2l01431j+J/cgibuF1G2LVrV3d1E3OKUTH MY4WCLJWgAcxALFrc5BiyUiRLR/jMk6Wl30qW1QDHXT6wCNsYffb4ol2QPFP0GqP 8Bu/eYiA =SKYZ -----END PGP SIGNATURE----- --MViTSF/MTmerS6va--