[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] ncurses: resize console if required
From: |
Carlo Marcelo Arenas Belon |
Subject: |
Re: [Qemu-devel] [PATCH] ncurses: resize console if required |
Date: |
Mon, 28 Apr 2008 12:56:31 -0500 |
User-agent: |
Mutt/1.4.1i |
On Mon, Apr 28, 2008 at 09:58:27AM +0100, Samuel Thibault wrote:
> Hello,
>
> Carlo Marcelo Arenas Belon, le Sun 27 Apr 2008 22:54:45 -0500, a écrit :
> > The following patch instructs qemu to print an escape command to resize the
> > curses console to 80x25 if detected to have a different geometry (xterm and
> > friends use 80x24 by default).
>
> > + /* check size of console and try to adjust if needed */
> > + getmaxyx(stdscr, gheight, gwidth);
> > + if ((gwidth != 80) || (gheight != 25)) {
> > + printf("\033[8;25;80t");
> > + }
>
> You can not just spit out escape sequences like this without know the
> kind of terminal you're in, you know :)
my original patch was checking the TERM variable for xterm or rxvt but since
CSI Window manipulation comes from dtterm I would expect most terminal
emulators to support that, do you have one that does not?
in the case of xterm with allowWindowOps = false the escape string gets just
ignored with no visible output, so expected the same from a terminal that
doesn't support it, but since it seems all the terminals I have access to do,
wasn't able to test that.
> At least check the TERM environment variable for those kind you know
> support it. Also, this should probably go inside the curses_resize()
> function, so that when the guest resizes to e.g. 80x50, the xterm window
> gets resized too.
from my tests, while booting a linux guest, curses_resize will be called with
a 66 x 3 geometry at least once, and a first attempt to make the guest use a
resized console of 80x50 didn't reflect correctly in the curses side either so
I settled for this different implementation as a starting point, and that
solves the problem with default sized xterm used as a curses console.
my intention with this patch was to propose a simple solution to this problem
and hopefully get someone else with more experience in curses and terminal
emulations intrigued enough to give it a more complete spin.
Carlo