bug-ncurses
[Top][All Lists]
Advanced

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

tput's behaviour changed


From: Ehsan Ghorbannezhad
Subject: tput's behaviour changed
Date: Mon, 22 Nov 2021 00:32:48 +0330

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.



reply via email to

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