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);