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

Re: ncurses problem



On 9/28/18 9:44 AM, Sven Joachim wrote:
On 2018-09-27 08:51 -0400, Greg Wooledge wrote:

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.

Actually it is exactly the other way around.  If LINES and COLUMNS are
set in the environment, then the ncurses library will _not_ update the
screen size upon receiving SIGWINCH, and that causes the behavior
Grzesiek observed.  This is documented in ncurses(3).

It seems that the problem is not related to the environment:

# set | egrep 'LINE|COL|BASHOPTS'
BASHOPTS=checkwinsize:cmdhist:complete_fullquote:expand_aliases:extquote:force_fignore:hostcomplete:interactive_comments:login_shell:progcomp:promptvars:sourcepath
BASH_LINENO=()
COLORTERM=truecolor
COLUMNS=119
LINES=84
# ssh localhost
# set | egrep 'LINE|COL|BASHOPTS'
BASHOPTS=checkwinsize:cmdhist:complete_fullquote:expand_aliases:extquote:force_fignore:hostcomplete:interactive_comments:login_shell:progcomp:promptvars:sourcepath
BASH_LINENO=()
COLUMNS=119
LINES=84

--
Pozdrawiam
Grzesiek

Wysłane z kompa wolnego od wirusów Billa Gatesa.


Reply to: