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

Re: [Xen-users] xen console dimensions

Am 25.06.14 11:38, schrieb Atom2:
I was annoyed by this a long time ago and have (back some time) found a
workable solution - at least for me. After a lengthy digging excercise
through the internet using google I found a small piece of C code
somewhere (I can't remember where) which seemd to be what I am after. I
downloaded it and compiled it. I called the binary resize, put it under
my /usr/local/bin and created an alias for my bash which reads
         alias cd='resize ; cd'
In essence this means it gets fired whenever I issue a cd command. It is
quick, so there is no noticeable delay and it resizes the window to
whatever the ssh terminal emulator (I use putty) is set to at that time.

You could use every command for the alias, but the cd command is one
that I frequently use. The alias sequence therefore updates the window
size not constantly, but with a reasonable frequency.
Over and above this I have included the following sequence in the global
/etc/bash/bashrc file so it gets fired for every login process and sets
the size correctly at login:
         if [[ -z "$STY" ]]; then
                 /usr/local/bin/resize   # set correct terminal size

Clearly this approach is not fool-proof and it can miss changes from
time to time (mostly notable in vi, but then getting out and using cd
[or even just start resize] immediately rectifies the situation).

I have attached the source code of this program in the hope that the
logic used could somehow be incorporated into XEN to make things
automatic. It is only 200 odd lines of code including around 50 lines of
headers/comments and around 20 lines of #include statements - so not
very complicated for someone who understands terminal emulation.

But I have to admit I am with Ian here: Terminal emulation is a bit of a
mystery to me as well ...

Regards Atom2
Sorry - I pressed send to quickly and missed to attach the source. So here we go ...

Regards Atom2

Attachment: resize.c
Description: Text document

Xen-users mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.