[comp.unix.sysv386] why doesnt vi resize itself in xterm and other weirdness

cpcahil@virtech.uucp (Conor P. Cahill) (01/12/91)

In article <37871@cup.portal.com> DeadHead@cup.portal.com (Bruce M Ong) writes:
>running in an xterm, but when I resize the xterm and restart vi, 
>it will not chanage its window size according to the size of xterm. My

You need to run:

	eval `resize -u`

Assuming you are not using the C shell.

>	Another problem is that if you do rlogin and then vi on the
>remote machine from an xterm, the vi window is always 25x80 no matter
>what size your xterm is. Is there anything I should fix in xterm termcap?

On the remote machine place the same line into your .profile.  For
example, my .profile has the following stuff in it:

	if [ "$TERM" = xterm -a "`tty`" != "not a tty" ]; then
		echo "sizing terminal...\c"
		eval `resize -u`
		echo "done"
	fi

This even works when connected via serial lines (cu) to other systems
(assuming you have those lines in the .profile file on the system you
are connected to).

-- 
Conor P. Cahill            (703)430-9247        Virtual Technologies, Inc.,
uunet!virtech!cpcahil                           46030 Manekin Plaza, Suite 160
                                                Sterling, VA 22170 

mschedlb@hawk.ulowell.edu (Martin J. Schedlbauer) (01/13/91)

In article <37871@cup.portal.com> DeadHead@cup.portal.com (Bruce M Ong) writes:
>Hi -
>	I am playing around with a big monitor (corner stone) on the
>ISC2.2 unix. The resolution is 1600x1024 or something. I have a vi
>running in an xterm, but when I resize the xterm and restart vi, 
>it will not chanage its window size according to the size of xterm. My

Unfortunately I'm not a termcap hacker so I can'te tell you how to write
a fixed termcap. However, I have the same problem under Esix and I can
"fix" it by setting the environment variables COLUMNS and LINES to the
sizes after you resize your xterm.

	...Martin


Martin Schedlbauer				(mschedlb@ulowell.edu)
Institute for Visualization and Perception Research
Department of Computer Science
University of Lowell, Lowell, MA 01854		(Tel: (508) 934-3612)

sef@kithrup.COM (Sean Eric Fagan) (01/13/91)

In article <37871@cup.portal.com> DeadHead@cup.portal.com (Bruce M Ong) writes:
>Hi -
>	I am playing around with a big monitor (corner stone) on the
>ISC2.2 unix. The resolution is 1600x1024 or something. I have a vi
>running in an xterm, but when I resize the xterm and restart vi, 
>it will not chanage its window size according to the size of xterm. My
>TERM is set to xterm. Why is this so? My sparc station doesnt seem to do 
>this at all.

Your TERM variable, in this case, doesn't matter.  Under BSD-based systems
(and some SysV systems, but not all, by any means), resizing a window causes
the window program (xterm, in this case) to send a SIGWINCH to the process
group running in that window; if the program has been written to accept it,
it will then do an ioctl(fd, TIOCGWINSZ, &buf) to get the size of the
window.  (I think that's the ioctl.)

However, SysV does not have this for normal pseudo-tty's (which is what most
xterms use).  The STREAMS-based ptys, which are unsupported (and, I believe,
undocumented), *do* support the necessary ioctl, but I don't know of any X
implementation that uses them.

>	Another problem is that if you do rlogin and then vi on the
>remote machine from an xterm, the vi window is always 25x80 no matter
>what size your xterm is. Is there anything I should fix in xterm termcap?

export LINES=<lines> COLUMNS=<rows>

SCO ships a program called resize, which I tend to use as

	eval $(resize)

(I use ksh); this spits out a TERMCAP, I believe, as well the LINES and
COLUMNS variables.  (I don't know if resize is a standard program or not.)
Note, however, that you would have to quit vi to take advantage of a resized
window.

-- 
Sean Eric Fagan  | "I made the universe, but please don't blame me for it;
sef@kithrup.COM  |  I had a bellyache at the time."
-----------------+           -- The Turtle (Stephen King, _It_)
Any opinions expressed are my own, and generally unpopular with others.

dswartz@bigbootay.sw.stratus.com (Dan Swartzendruber) (01/15/91)

Speaking of weirdness with xterm...  I am running ESIX Rev D with
the Motif package.  When I send mail from a normal shell, the mail
header shows it as being sent by me.  If I send the same mail from
an xterm window, it shows up as sent by root.  Any ideas?
--

Dan S.

fangchin@elaine8.stanford.edu (Chin Fang) (01/15/91)

In article <1991Jan13.100440.2138@kithrup.COM> sef@kithrup.COM (Sean Eric Fagan) writes:
>
>>	Another problem is that if you do rlogin and then vi on the
>>remote machine from an xterm, the vi window is always 25x80 no matter
>>what size your xterm is. Is there anything I should fix in xterm termcap?
>
I do remote login from my ESIX Rev D X's xterms to SUN, VAX8800, MIPS
5400, all run UNIX.  My modem program is CKermit or Pcomm.  I also do
rlogin from one UNIX machine to another all the time.   

I always can at least manually tell vi, emacs, less, more etc to adjust
to the right window size by typing (or including in appropriate login
initialization files, depending your shell):

stty cols c# rows r# [enter]

where c# is the desired column number (100 for example)
      r# is the desired row number  (42 for example)

Hope this helps

Regards

Chin Fang
Mechanical Engineering Department
Stanford University
fangchin@portia.stanford.edu

sef@kithrup.COM (Sean Eric Fagan) (01/15/91)

In article <1991Jan14.215038.9834@portia.Stanford.EDU> fangchin@elaine8.stanford.edu (Chin Fang) writes:
>I always can at least manually tell vi, emacs, less, more etc to adjust
>to the right window size by typing (or including in appropriate login
>initialization files, depending your shell):
>
>stty cols c# rows r# [enter]

Once again (repeating what I'd said in my post to which he followed up),
only the STREAMS ptys in 3.2 support the rows and columns features
(TIOCGWINSZ, I believe, and TIOCSWINSZ to set).  stty does not support it at
all, since no supported ttys support them.  Since they are not supported,
vi, more, and all other utilities distributed by the vendors (well, SCO and
AT&T at least) do not support it; I can make emacs and less support it, but
it would be futile, since only the STREAMS ptys would allow the ioctl.

Instead, use the LINES and COLUMNS variables; terminfo utilities, at least,
will use this; I forget whether or not termcap checks it.

-- 
Sean Eric Fagan  | "I made the universe, but please don't blame me for it;
sef@kithrup.COM  |  I had a bellyache at the time."
-----------------+           -- The Turtle (Stephen King, _It_)
Any opinions expressed are my own, and generally unpopular with others.