Re: Resizing a terminal window
David, you're very welcome! H. On 5/7/2010 12:29 PM, J. David Boyd wrote: Hans Horn writes: David, This took me forever to figure out! 'expect' does not forward SIGWINCH (http://en.wikipedia.org/wiki/SIGWINCH) unless told to do so. Add the following snippet (between lines marked with ###) to the beginning of your 'expect' script: #!/bin/sh # \ exec expect -f "$0" ${1+"$@"} ### trap { # trap sigwinch and pass it to the child we spawned set rows [stty rows] set cols [stty columns] stty rows $rows columns $cols< $spawn_out(slave,name) } WINCH ### set host [lindex $argv 0] ... I use this to log on from cygwin to various AIX and LINUX machines. Good luck and let me know how goes, Hans That worked perfectly! Thank you very much, I don't think I would have ever figured that out! Dave -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: Resizing a terminal window
Hans Horn writes: > David, > > This took me forever to figure out! > > 'expect' does not forward SIGWINCH > (http://en.wikipedia.org/wiki/SIGWINCH) unless told to do so. > > Add the following snippet (between lines marked with > ###) to the beginning of your 'expect' script: > > #!/bin/sh > # \ > exec expect -f "$0" ${1+"$@"} > > ### > trap { # trap sigwinch and pass it to the child we spawned > set rows [stty rows] > set cols [stty columns] > stty rows $rows columns $cols < $spawn_out(slave,name) > } WINCH > ### > > set host [lindex $argv 0] > ... > > I use this to log on from cygwin to various AIX and LINUX machines. > > Good luck and let me know how goes, > Hans That worked perfectly! Thank you very much, I don't think I would have ever figured that out! Dave -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: Resizing a terminal window
David, This took me forever to figure out! 'expect' does not forward SIGWINCH (http://en.wikipedia.org/wiki/SIGWINCH) unless told to do so. Add the following snippet (between lines marked with ###) to the beginning of your 'expect' script: #!/bin/sh # \ exec expect -f "$0" ${1+"$@"} ### trap { # trap sigwinch and pass it to the child we spawned set rows [stty rows] set cols [stty columns] stty rows $rows columns $cols < $spawn_out(slave,name) } WINCH ### set host [lindex $argv 0] ... I use this to log on from cygwin to various AIX and LINUX machines. Good luck and let me know how goes, Hans On 5/7/2010 10:09 AM, J. David Boyd wrote: Hans Horn writes: On 5/5/2010 8:28 AM, J. David Boyd wrote: Thomas Wolff writes: Am 04.05.2010 16:03, schrieb J. David Boyd: ... Locally, I can use the mouse to resize a window, and the $COLUMNS and $LINES variables are automatically filled in. On many remote xterm sessions, they aren't. Does anyone have any idea where to start figuring out what is wrong, and what I can do to correct it? LINES and COLUMNS are legacy mechanisms which may serve as a workaround if the system doesn't otherwise handle screen size changes properly. They should not be needed on modern systems where the tty driver maintains the information. (You may note that mintty has not set them initially but they get set on resize - by whatever means... - while in a cygwin console they are not used at all.) So if you happen to have these variables set on a system which does not maintain them, they don't get changed on resize and confuse your environment. In most cases the best remedy is to just unset them - does that help? -- Thomas Sadly enough, the system I am connecting to, SUSE Linux, does use them, and the checkwinsize shopt BASH function, but, somehow, not correctly Just for curiosity: are you using 'expect' to log to the remote system? If so, you'd need you modify your expect script to handle SIGWINCH properly. Let me know... H. Yes I am. I use expect to login, then go interactive. There is a flag/setting to monitor SIGWINCH? Tell me, please!!! -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: Resizing a terminal window
Hans Horn writes: > On 5/5/2010 8:28 AM, J. David Boyd wrote: >> Thomas Wolff writes: >> >>> Am 04.05.2010 16:03, schrieb J. David Boyd: ... Locally, I can use the mouse to resize a window, and the $COLUMNS and $LINES variables are automatically filled in. On many remote xterm sessions, they aren't. Does anyone have any idea where to start figuring out what is wrong, and what I can do to correct it? >>> LINES and COLUMNS are legacy mechanisms which may serve as a >>> workaround if the system doesn't otherwise handle screen size changes >>> properly. They should not be needed on modern systems where the tty >>> driver maintains the information. >>> (You may note that mintty has not set them initially but they get set >>> on resize - by whatever means... - while in a cygwin console they are >>> not used at all.) >>> So if you happen to have these variables set on a system which does >>> not maintain them, they don't get changed on resize and confuse your >>> environment. In most cases the best remedy is to just unset them - >>> does that help? >>> >>> -- >>> Thomas >> >> Sadly enough, the system I am connecting to, SUSE Linux, does use them, >> and the checkwinsize shopt BASH function, but, somehow, not >> correctly > > Just for curiosity: are you using 'expect' to log to the remote system? > If so, you'd need you modify your expect script to handle SIGWINCH > properly. Let me know... > H. Yes I am. I use expect to login, then go interactive. There is a flag/setting to monitor SIGWINCH? Tell me, please!!! -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: Resizing a terminal window
On 5/5/2010 8:28 AM, J. David Boyd wrote: Thomas Wolff writes: Am 04.05.2010 16:03, schrieb J. David Boyd: ... Locally, I can use the mouse to resize a window, and the $COLUMNS and $LINES variables are automatically filled in. On many remote xterm sessions, they aren't. Does anyone have any idea where to start figuring out what is wrong, and what I can do to correct it? LINES and COLUMNS are legacy mechanisms which may serve as a workaround if the system doesn't otherwise handle screen size changes properly. They should not be needed on modern systems where the tty driver maintains the information. (You may note that mintty has not set them initially but they get set on resize - by whatever means... - while in a cygwin console they are not used at all.) So if you happen to have these variables set on a system which does not maintain them, they don't get changed on resize and confuse your environment. In most cases the best remedy is to just unset them - does that help? -- Thomas Sadly enough, the system I am connecting to, SUSE Linux, does use them, and the checkwinsize shopt BASH function, but, somehow, not correctly Just for curiosity: are you using 'expect' to log to the remote system? If so, you'd need you modify your expect script to handle SIGWINCH properly. Let me know... H. -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: Resizing a terminal window
Andy Koppe writes: > J. David Boyd wrote: >> I don't think it is a Cygwin issue at all. And, I'm certain it is a >> remote server problem, as it works on many boxes. >> >> I was just looking for some help and ideas, and the Cygwin list seemed a >> good place to start since I use Cygwin. > > Right. This list is all about the misery of using Cygwin though. > >> I re-discovered the >> shopt parameter of checkwinsize, which is what controls Bash monitoring >> the window size from my prior message. > > Bash also sets LINES and COLUMNS when it receives a SIGWINCH ("window > change") signal, apparently independent of 'checkwinsize'. Only the > foreground process gets that signal though. So without 'checkwinsize', > the setting of those variables depends on whether bash was in the > foreground when the terminal was resized. > > Andy It is, as I am clicking the window I want to resize, and using the mouse to drag the bottom right corner to the dimensions that I want. SSHing in to my Mandriva box, it works perfectly. SSHing in to my SUSE Linux box, I have to do an "eval `resize`". SSHing in to my Ubuntu 9.10 box, it works perfectly. Something must be broken in SUSE Linux Dave -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: Resizing a terminal window
Thomas Wolff writes: > Am 04.05.2010 16:03, schrieb J. David Boyd: >> ... >> >> Locally, I can use the mouse to resize a window, and the $COLUMNS and >> $LINES variables are automatically filled in. >> >> On many remote xterm sessions, they aren't. >> >> Does anyone have any idea where to start figuring out what is wrong, and >> what I can do to correct it? >> > LINES and COLUMNS are legacy mechanisms which may serve as a > workaround if the system doesn't otherwise handle screen size changes > properly. They should not be needed on modern systems where the tty > driver maintains the information. > (You may note that mintty has not set them initially but they get set > on resize - by whatever means... - while in a cygwin console they are > not used at all.) > So if you happen to have these variables set on a system which does > not maintain them, they don't get changed on resize and confuse your > environment. In most cases the best remedy is to just unset them - > does that help? > > -- > Thomas Sadly enough, the system I am connecting to, SUSE Linux, does use them, and the checkwinsize shopt BASH function, but, somehow, not correctly -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: Resizing a terminal window
J. David Boyd wrote: > I don't think it is a Cygwin issue at all. And, I'm certain it is a > remote server problem, as it works on many boxes. > > I was just looking for some help and ideas, and the Cygwin list seemed a > good place to start since I use Cygwin. Right. This list is all about the misery of using Cygwin though. > I re-discovered the > shopt parameter of checkwinsize, which is what controls Bash monitoring > the window size from my prior message. Bash also sets LINES and COLUMNS when it receives a SIGWINCH ("window change") signal, apparently independent of 'checkwinsize'. Only the foreground process gets that signal though. So without 'checkwinsize', the setting of those variables depends on whether bash was in the foreground when the terminal was resized. Andy -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: Resizing a terminal window
Thomas Wolff wrote: > LINES and COLUMNS are legacy mechanisms which may serve as a workaround if > the system doesn't otherwise handle screen size changes properly. They > should not be needed on modern systems where the tty driver maintains the > information. Yep. > (You may note that mintty has not set them initially but they get set on > resize - by whatever means... - while in a cygwin console they are not used > at all.) Xterm and rxvt don't set them either. Bash sets them on receiving a SIGWINCH, but not at startup. Go figure. Andy -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: Resizing a terminal window
Am 04.05.2010 16:03, schrieb J. David Boyd: ... Locally, I can use the mouse to resize a window, and the $COLUMNS and $LINES variables are automatically filled in. On many remote xterm sessions, they aren't. Does anyone have any idea where to start figuring out what is wrong, and what I can do to correct it? LINES and COLUMNS are legacy mechanisms which may serve as a workaround if the system doesn't otherwise handle screen size changes properly. They should not be needed on modern systems where the tty driver maintains the information. (You may note that mintty has not set them initially but they get set on resize - by whatever means... - while in a cygwin console they are not used at all.) So if you happen to have these variables set on a system which does not maintain them, they don't get changed on resize and confuse your environment. In most cases the best remedy is to just unset them - does that help? -- Thomas -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: Resizing a terminal window
Andy Koppe writes: > J. David Boyd wrote: >> I'm using Cygwin to provide my own X server, and using Xterms locally, >> and to connect to remote servers. >> >> Locally, I can use the mouse to resize a window, and the $COLUMNS and >> $LINES variables are automatically filled in. >> >> On many remote xterm sessions, they aren't. >> >> Does anyone have any idea where to start figuring out what is wrong, and >> what I can do to correct it? >> >> My quick work-around is to resize the window, then call "eval `resize`", >> but I would like it to be automatic. > > Any particular reason to think that this is an issue with Cygwin > rather than your remote systems? > > Resizing is working fine here when connected to a Debian box either > via ssh or telnet running in a local xterm. If you're running xterm on > the remote system with only its display forwarded to your Cygwin/X > server, then Cygwin doesn't have anything to do with the terminal > resize notifications. > > Andy I don't think it is a Cygwin issue at all. And, I'm certain it is a remote server problem, as it works on many boxes. I re-discovered the shopt parameter of checkwinsize, which is what controls Bash monitoring the window size from my prior message. I was just looking for some help and ideas, and the Cygwin list seemed a good place to start since I use Cygwin. But I never meant to cast disparagements on Cygwin, it is a great piece of software... Dave -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: Resizing a terminal window
J. David Boyd wrote: > I'm using Cygwin to provide my own X server, and using Xterms locally, > and to connect to remote servers. > > Locally, I can use the mouse to resize a window, and the $COLUMNS and > $LINES variables are automatically filled in. > > On many remote xterm sessions, they aren't. > > Does anyone have any idea where to start figuring out what is wrong, and > what I can do to correct it? > > My quick work-around is to resize the window, then call "eval `resize`", > but I would like it to be automatic. Any particular reason to think that this is an issue with Cygwin rather than your remote systems? Resizing is working fine here when connected to a Debian box either via ssh or telnet running in a local xterm. If you're running xterm on the remote system with only its display forwarded to your Cygwin/X server, then Cygwin doesn't have anything to do with the terminal resize notifications. Andy -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple