Web lists-archives.com

Re: ncurses problem




On Wed, Sep 26, 2018 at 10:38:53PM +0000, Grzesiek Sójka wrote:
> Hi there,
> 
> I compiled following test program:
> ==========================================
> #include <ncurses.h>
> #include <string.h>
[snip]

> It's supposed to show current window dimension when resizing terminal
> window. Unfortunately, dimensions are not updated and it shows initial
> geometry. Interesting thing is that it works perfectly after "ssh localhost"
> or "su -". I tested on both, sid and stretch. exactly the same result.
> 
> Any ideas??

My first thought is that your shell login profile,

> PS. I use xfce4 and lxdm.

... which is NOT how you normally log in, is turning on bash's
checkwinsize option, which causes bash to set the LINES and COLUMNS
variables upon receipt of a SIGWINCH (a signal that is sent when the
window changes size).

In the absence of that option, those variables might not be set at all,
or might be set to the wrong size, and won't be updated when the window
changes size while sitting in an idle shell.

(What an ncurses program does with this signal, I honestly do not know.)

So, just wild-ass guessing here, you might have put the necessaray
"shopt -s checkwinsize" and "export LINES COLUMNS" into ~/.profile
which is only read when you perform a shell login, and NOT when you
perform an lxdm login.  That's why something might "work" when you
first do "ssh localhost" to get a shell login environment.