TerminalView window manipulations.

Ask about the individual Gambas components here.
Post Reply
User avatar
Posts: 685
Joined: Thursday 23rd July 2020 5:20pm

TerminalView window manipulations.

Post by BruceSteers » Wednesday 16th December 2020 3:12pm

TerminalView now supports XTerm 'CSI Ps,Ps,Ps t' excape sequences to manipulate the terminals window.

From the commit message...
* NEW: TerminalView: Various XTerm window manipulation escape sequences added to VT100.
* NEW: TerminalView: Added WindowCommands boolean property to enable manipulations.

Useful if your terminalview is a standalone in a form/window although
handling has been added to account for other objects in a form.

Set property TerminalView1.WindowCommands = True and it enables
XTerm escape sequences on the top window...

Eg. Type...
echo -en "\033[10;2t"
to toggle fullscreen
Handles the following modes...

1, Minimize false
2, Minimize true
3, Move window (x,y)
4, Resize (h,w) in pixels
5, Send to front (Window.Raise)
6, Send to back (Window.Lower)
7, Refresh (useless but it would be a shame to do 1-10 and leave 7 out.)
8, Resize (lines, cols) text characters
9;0 Maximize false
9;1 Maximize true (also works as true/false toggle)
10;0 Full screen off
10;1 Full screen on
10;2 Full screen toggle
Adds a boolean Property called WindowCommands to Terminal, can be set in the IDE or at runtime.
Once set echoing various escape sequences in the terminal will perform the above actions.
Use $ echo -en "\033[ + numeric sequence listed above + t"

Resize Terminal 10 characters high and 80 wide
$ echo -en "\033[8;10;80t"

Maximize/Demaximize window
$ echo -en "\033[9;1t"

Point of note when enabling resize in your from..
The resize function will take into account the size any panels/objects you also have in your form outside the terminalview .
It does that by first noting Window.Height - TemrinalView.Height and Window.Width - TerminalView.Width (the area outside the terminal object)
Then it adds that size to the requested terminalview size making the new window size enough to give the terminal the correct size.
This however will not work if you use things like a HSplit.
If your form has other objects/panels outside the terminal object they MUST be a fixed size.
Wishing well

If at first you don't succeed , try it differently.

Post Reply