Mark Richards <
kmal...@gmail.com> wrote:
> It would be sweet if putty provided a trigger event which will launch
> the script in my terminal session when the window has been re-sized.
> Ideally, the script would be launched after a slight delay following
> mouse up after the re-size action.
Hmmm. The idea being that you use this when PuTTY is talking to a
serial line, or for some other reason the usual Telnet/SSH mechanism
for auto-notifying the server about window resizes is not available or
not working?
> Of course, the script can't launch if a user is not at a command prompt.
> Not certain how putty might make this distinction.
Yes, that would be tricky. You could imagine emitting some kind of
escape sequence which would notify PuTTY when you entered and left
command-prompt mode, but that would be pretty fragile - no end of
glitches could cause one of those sequences to be dropped by mistake,
and even _in_ command-prompt mode just sending the command followed by
Return would be iffy if you had another command half-typed.
If I wanted a serial-port connection to pick up my window resizes
automatically, I'd probably prefer to do it by putting an extra
protocol layer _between_ the raw serial line and the tty session - and
the obvious protocol to choose would be Telnet, which is conveniently
lightweight and already has built-in window-size notification.
Setting up such a session would be fiddly - you'd have to make PuTTY
believe it was speaking Telnet but have it use Plink in serial mode
(or equivalent) as a local proxy command, and on the server end you'd
have to run a telnetd with some curious options wrapping your shell
(in fact it's quite possible that using the simplistic one in
putty/contrib/cygtermd might be easier than persuading the system
telnetd to do what you wanted), and if you didn't have hardware flow
control then you'd also have to bodge all of this to cope somehow with
XON/XOFF - but once you'd got it working, window resizes would be
picked up even in the middle of running a full-screen application such
as an editor. (Which would be important to me, since editing sessions
are often the moment when I suddenly _realise_ I want to make my
window wider!)
--
import hashlib; print (lambda p,q,g,y,r,s,m: m if (lambda w:(pow(g,int(hashlib.
sha1(m).hexdigest(),16)*w%q,p)*pow(y,r*w%q,p)%p)%q)(pow(s,q-2,q))==r else "!"
)(0xb80b5dacabab6145, 0xf70027d345023, 0x7643bc4018957897, 0x11c2e5d9951130c9,
0xa54d9cbe4e8ab, 0x746c50eaa1910, "Simon Tatham <
ana...@pobox.com>")