[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tput's behaviour changed
From: |
Thomas Dickey |
Subject: |
Re: tput's behaviour changed |
Date: |
Mon, 22 Nov 2021 18:49:47 -0500 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Mon, Nov 22, 2021 at 07:01:05PM +0330, Ehsan Ghorbannezhad wrote:
> Oh sorry for missing that thread,
> I searched the archive for "tput" but didn't see that one.
>
> I resorted to something like this to get the terminal dimensions:
>
> stty size </dev/"$(ps -o tty= -p $$)"
you could do the same with tput, e.g.,
tput cols </dev/"$(ps -o tty= -p $$)"
>
> On 21-11-21 16:54, Thomas Dickey wrote:
> > ----- Original Message -----
> > | From: "Ehsan Ghorbannezhad" <ehsan@disroot.org>
> > | To: "Ncurses Mailing List" <bug-ncurses@gnu.org>
> > | Sent: Sunday, November 21, 2021 4:02:48 PM
> > | Subject: tput's behaviour changed
> >
> > | Hi,
> > |
> > | The ncurses-6.2-20211009 patch contains changes to the
> > progs/tty_settings.c
> > | file, which cause the `tput cols` and `tput lines` commands to return
> > | wrong values (80 and 24) when invoked from inside
> > | my terminal file manager's previewer script.
> > |
> > | Per my testing, these are the changes that cause this breakage:
> > |
> > | --- ncurses-6.2-20211002+/progs/tty_settings.c
> > | +++ ncurses-6.2-20211009/progs/tty_settings.c
> > | @@ -74,10 +74,12 @@
> > | {
> > | if (!get_tty_settings(STDERR_FILENO, tty_settings) &&
> > | !get_tty_settings(STDOUT_FILENO, tty_settings) &&
> > | - !get_tty_settings(STDIN_FILENO, tty_settings) &&
> > | - !get_tty_settings(open("/dev/tty", O_RDWR), tty_settings)) {
> > | + !get_tty_settings(STDIN_FILENO, tty_settings)) {
> > | if (need_tty) {
> > | - failed("terminal attributes");
> > | + int fd = open("/dev/tty", O_RDWR);
> > | + if (!get_tty_settings(fd, tty_settings)) {
> > | + failed("terminal attributes");
> > | + }
> > | } else {
> > | my_fd = fileno(stdout);
> > | }
> > |
> > | All versions prior to 6.2-20211009 don't have this problem.
> > | Tested on several terminal emulators.
> >
> > start here
> >
> > https://lists.gnu.org/archive/html/bug-ncurses/2021-11/msg00001.html
> >
> > --
> > Thomas E. Dickey <dickey@invisible-island.net>
> > http://invisible-island.net
> > ftp://ftp.invisible-island.net
--
Thomas E. Dickey <dickey@invisible-island.net>
https://invisible-island.net
ftp://ftp.invisible-island.net
signature.asc
Description: PGP signature