Skip Menu |

This queue is for tickets about the Curses-UI CPAN distribution.

Report information
The Basics
Id: 43021
Status: new
Priority: 0/
Queue: Curses-UI

People
Owner: Nobody in particular
Requestors: 133f5bf1 [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.96
Fixed in: (no value)



Subject: Curses unusable if GetTerminalSize does not determine screen geometry
The call to GetTerminalSize can return all zero values for screen geometry (columns and rows) of a terminal, particularly upon installation of a Linux distribution with limited termcaps and/or while using a serial port console. The three calls to GetTerminalSize in UI.pm should detect this case and prompt the user to type the correct terminal size. Another option would be to use some reasonable default values (80x25) then use a Curses window to allow the values to be entered. As a workaround, I've replaced the calls to GetTerminalSize with safe_GetTerminalSize() as a subroutine with (in my case) hard-coded values returned if the values returned by GetTerminalSize are zero. This is obviously not ideal, but it does solve the issue for me. I don't know what is the "standard" way (if there is one) to prompt the user for such details within Curses, since there is no interface as such yet, thus we can't display widgets, and STDIN seems already intercepted by the first time this is called. The basic logic for fixing this problem is simple: sub safe_GetTerminalSize() { my ($cols,$lines) = GetTerminalSize; if ($cols == 0) { #prompt user for $cols } if ($lines == 0) { #prompt user for $lines } return ($cols,$lines); } Then just: s/GetTerminalSize/safe_GetTerminalSize/g (there are only three instances) Currently, without this patch, if GetTerminalSize returns zero, Curses will simply "die" with a loop of error messages about the display size being too small. I actually think this should be a "Critical" bug, since Curses becomes totally useless, but submitting as "Normal". I know it is not a very common case that GetTerminalSize will return zero, but still I think the return should be validated before use and gracefully prompt the user. Thank you!