mirror of
https://github.com/lihop/godot-xterm.git
synced 2024-11-25 10:40:25 +01:00
Copy old cells to new cells when resizing
Previously all cells were erased which resulted in the screen becoming
blank in some places until it was redrawn.
Former-commit-id: ada8b1087d
This commit is contained in:
parent
313f6b8b60
commit
11657d50f7
1 changed files with 12 additions and 3 deletions
|
@ -536,20 +536,29 @@ void Terminal::update_size()
|
||||||
|
|
||||||
Godot::print(String("resized_rows: {0}, resized_cols: {1}").format(Array::make(rows, cols)));
|
Godot::print(String("resized_rows: {0}, resized_cols: {1}").format(Array::make(rows, cols)));
|
||||||
|
|
||||||
cells = {};
|
Cells new_cells = {};
|
||||||
|
|
||||||
for (int x = 0; x < rows; x++)
|
for (int x = 0; x < rows; x++)
|
||||||
{
|
{
|
||||||
Row row(cols);
|
Row row(cols);
|
||||||
|
|
||||||
for (int y = 0; y < cols; y++)
|
for (int y = 0; y < cols; y++)
|
||||||
|
{
|
||||||
|
if (x < cells.size() && y < cells[x].size())
|
||||||
|
{
|
||||||
|
row[y] = cells[x][y];
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
row[y] = empty_cell;
|
row[y] = empty_cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
cells.push_back(row);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
new_cells.push_back(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
cells = new_cells;
|
||||||
|
|
||||||
tsm_screen_resize(screen, cols, rows);
|
tsm_screen_resize(screen, cols, rows);
|
||||||
|
|
||||||
sleep = false;
|
sleep = false;
|
||||||
|
|
Loading…
Reference in a new issue