TerminalControl display truncated leaving the control

0 votes
asked May 28, 2012 by Andre (650 points)
edited May 29, 2012

Hi,

I have to use many TerminalControl in the same application and when I switch from one to another I lose a part of the terminal screen(the remaining part is a square in upper left). When the AutoAdjustTerminalSize is set to false it doesn't occurs but I need it to be true because the application can be resized.

An idea ?

Regards André Sanscartier

commented May 29, 2012 by Lukas Matyska (59,010 points)
edited May 29, 2012

It is hard to say what is going on without any closer knowledge of your application. It seems that during switching between TerminalControls a resize is performed. It may be caused by Docking (or Anchoring) of the control. Can you please send us your project or light version of it to support@rebex.net? We need to know how to reproduce your issue.

commented May 29, 2012 by Andre (650 points)
edited May 29, 2012

It works fine now, I changed my code to fix the minimum size of the TerminalControls. Is there a way to avoid losing the part of the text that it outside the viewing area after a rezise ? When the control is resized to its original size the hidden text should reappear.

1 Answer

0 votes
answered May 29, 2012 by Lukas Matyska (59,010 points)
edited May 29, 2012

No, if the TerminalControl is resized, the screen buffer is resized accordingly, therefore some characters can be lost. But you can save content of the screen and restore it manually like this:

// save screen and cursor position
TerminalScreenRegion savedScreen = terminal.Screen.GetRegion(0, 0, terminal.Screen.Columns, terminal.Screen.Rows);
int savedCursorLeft = terminal.Screen.CursorLeft;
int savedCursorTop = terminal.Screen.CursorTop;

// restore screen and cursor position
for (int i = 0; i < savedScreen.Width; i++)
{
    for (int j = 0; j < savedScreen.Height; j++)
    {
        terminal.Screen.SetCell(i, j, savedScreen[i, j]);
    }
}
terminal.Screen.SetCursorPosition(savedCursorLeft, savedCursorTop);
...