[Gambas-user] NCurses window height and width

Tobias Boege taboege at gmail.com
Sun May 5 23:57:18 CEST 2019


On Sun, 05 May 2019, KKing wrote:
> Okay, so presume it is related to default (system?) settings, at least while
> running under LXDE.
> If I open a terminal, it is already set at 80x24, if I copy paste your
> script and run script from terminal that is currently 80x24 it stays 80x24.
> If I expand the terminal window, the green area remains at 80x24.
> If I open LXTerminal and take option to resize to 132x43 and run script then
> the green background only covers the 120 x 40 area.

This is true. An ncurses window is an abstraction for a rectangular part
of the terminal screen. If your terminal is small, your window can only
be small. (Though I'm not sure if this is an arbitrary limit imposed by
gb.ncurses' Window constructor or by ncurses itself.)

> When I run in Gambas I was expecting/hoping it opens the terminal to the
> size you requested .... obviously not, it is asking for a terminal to be
> opened which defaults to the system default and then is running the ncurses
> code into.
> As the final solution has no X this maybe irrelevant, but I've not had
> chance to test yet.
> 

By the time you create the window, the terminal emulator is long
started, put into an X window and initialised. ncurses "window" does
not relate to X "window". In fact ncurses does not know about X.
Better think about an ncurses Window as a DrawingArea for characters.
Drawing inside it cannot make the containing window bigger.

However, if your terminal is inside an X window and that window is
resized, a special signal is sent to the process which gb.ncurses
should be able to handle and update its idea of the current terminal
size. You can react to this via the Screen_Resize event and try to
enlarge your window if you have more space available now.

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk


More information about the User mailing list