Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!pasteur!icsib2.Berkeley.EDU!stolcke From: stolcke@icsib2.Berkeley.EDU (Andreas Stolcke) Newsgroups: comp.windows.x Subject: Re: how does xterm tell vi the window size Keywords: xterm vi Message-ID: <17994@pasteur.Berkeley.EDU> Date: 4 Oct 89 22:11:14 GMT References: <253@zeek.UUCP> Sender: news@pasteur.Berkeley.EDU Reply-To: stolcke@icsi.Berkeley.EDU Organization: International Computer Science Institute, Berkeley Lines: 39 > From an xterm, I logged on to a remote host and tried to vi a file. > vi thinks that the window is 24 lines deep. It has no idea that I have > extended the window to >30 lines. > vi apparently goes to the termcap entry for xterm and finds out that > the default window size is 24x80. However, the window is not necessarily > that size. I'm not an expert on this, but from what I know about UNIX here's one way it could actually be implemented. vi doesn't rely on termcaps to figure out the window size. Instead, it looks up the relevant tty parameters (including window size) via ioctl() calls. These parameters get set by the process controlling the pseudo terminal (i.e., xterm). Processes running in the pty can be notified of a change in window size by way of a dedicated signal (SIGWINCH) so they know when to reconsult pty parameters and adjust. Now, rlogin opens a new pty on the remote machine. So on receiving a SIGWINCH the rlogin process can communicate the new window size to the remote pty and update parameters there, as well as send out SIGWINCH's to remote processes. Something to this effect actually happens since 'stty all' shows modified 'rows' and 'columns' parameters after a window resize, both on local and remote machines. A fresh vi process does always know about the current window size, both local and remote. Apparently, however, vi doesn't care or know about SIGWINCH since it won't adjust on a resize after startup. (I'm talking SunOS 4.0.3 here). From your posting I infer that on your system window size is not correctly propagated across rlogins as described above. Maybe you're not running a BSDish UNIX ? ---- Andreas Stolcke International Computer Science Institute stolcke@icsi.Berkeley.EDU 1957 Center St., Suite 600, Berkeley, CA 94704 (415) 642-4274 ext. 126