row/column report escape sequence (and patch)
David Simmons <[email protected]> Thu, 26 Jun 2008 22:57:09 -0600
| Newsgroups | gmane.comp.gnu.screen |
|---|---|
| Message-ID | <48647325.5060102__29817.6977121786$1238089021$gmane$org@davidsimmons.com> |
I've noticed that screen doesn't implement a potentially useful escape sequence that allows the client to query the window size. (At least not in 4.0.2, which is the latest release version on the ftp site.) I'm not sure how standard this sequence is, but it's implemented by xterm, dtterm, gnome terminal, and probably others. I added support to my local copy by adding a few lines to ansi.c. In case anyone is interested, I've attached the patch. One reference I've found for this "CSI 18 ; t" sequence is here: http://rtfm.etla.org/xterm/ctlseq.html#CSI%20Ps%20;%20Ps%20;%20Ps%20t David
screen-4.0.2-sizereport.patch
(text/x-diff, 471 B)
diff -Nru screen-4.0.2.orig/ansi.c screen-4.0.2/ansi.c
--- screen-4.0.2.orig/ansi.c 2003-12-05 06:57:05.000000000 -0700
+++ screen-4.0.2/ansi.c 2008-06-26 22:25:26.000000000 -0600
@@ -1225,6 +1225,11 @@
SaveCursor();
break;
case 't':
+ if (a1 == 18) {
+ /* report the window size */
+ Report("\033[8;%d;%dt", curr->w_height, curr->w_width);
+ break;
+ }
if (a1 != 8)
break;
a1 = curr->w_args[2];