开发者

Xterm terminal and resize code

I am in progress of converting a really old 25+ year old application .

It sends an escape sequence to make the SCREEN 132 characters wide...

However it didnt work and i put the XTERM equilivment that seems to work in most cases..

It is

"\x1B[8;50;132t"

Although the screen resizes with success there is an issue Here is the code that the COBOL program uses to execute the command

   pg -f FILETOSHOW

using CALL "SYSTEM" USING BY CONTENT DS-REC

where DS-REC is the above command....

The problem is that although screen resizes data are printed with the previous settings... Calling again the program solves the issue and prints correctly...

Doesnt anybody knows whether i should send another escape co开发者_如何学Pythonde also?


The escape sequence is documented in XTerm Control Sequences, in the "Functions using CSI , ordered by the final character(s)" section, under this line:

CSI Ps ; Ps ; Ps t

It is one of the controls adapted from dtterm, and in particular

Ps = 8 ; height ; width

Resize the text area to given height and width in characters. Omitted parameters reuse the current height or width. Zero parameters use the display's height or width.

It was implemented in xterm in 1996 (patch #18).

Because some users view operations of this sort as a security problem (including resizing the font), a resource windowOps was added in 2003 (patch #174) to allow packagers to change the default behavior. That resource can be modified at runtime using a menu entry, as well as set directly in a user's X resources.

In short, the feature is present in xterm, but may require (simple) configuration changes to use it.

The control sequence to resize the xterm window is a request to the window manager. The window manager may not honor the request, e.g., for tiling window managers it would always fail. Also, because xterm does not change the font-size dynamically, it may fail if the font size is too large to permit 132 columns on the screen. The fixed font probably works for modern large displays (my 1280x1024 monitor can display 60x210 with some slack), but large fonts may not.

When it fails to resize as large as requested, it is the window manager which handles the request: xterm has forgotten by the time the request is completed, and will accept whatever the window manager does.


Do not rely on these escape codes. xterm will not set itself to a size greater than the screen. So given the user has a large-enough font and/or a small-enough screen, he will not get his 132x50 terminal automatically, much less will the automatic sizing do it. (E.g. lucida console at 15pt on 1024x600 minus a taskbar and WM deco gives me room for 85x28 cells.)

If your program requires such an awkward vt size of 132x50, request it of the user as a prerequisite. Or just make your program actually run on any variable size.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜