mirror of
https://review.haiku-os.org/haiku
synced 2025-02-22 21:48:35 +01:00
* Forgot to clear the lines of the alternate screen buffer on
initialization. This would lead to crashes when resizing. * Shuffled code in ResizeTo() a bit to make it more robust in case of error (out of memory). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26004 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
d04aae8b80
commit
7f6f9ddb94
@ -45,6 +45,9 @@ TerminalBuffer::Init(int32 width, int32 height, int32 historySize)
|
||||
if (fAlternateScreen == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
for (int32 i = 0; i < height; i++)
|
||||
fAlternateScreen[i]->Clear();
|
||||
|
||||
return BasicTerminalBuffer::Init(width, height, historySize);
|
||||
}
|
||||
|
||||
@ -141,31 +144,31 @@ TerminalBuffer::ResizeTo(int32 width, int32 height, int32 historyCapacity)
|
||||
return error;
|
||||
}
|
||||
|
||||
TermPos cursor = fCursor;
|
||||
|
||||
// Switch to the alternate screen buffer and resize it.
|
||||
if (fAlternateScreen != NULL) {
|
||||
_SwitchScreenBuffer();
|
||||
|
||||
TermPos cursor = fCursor;
|
||||
fCursor.SetTo(0, 0);
|
||||
fWidth = oldWidth;
|
||||
fHeight = oldHeight;
|
||||
fCursor.SetTo(0, 0);
|
||||
|
||||
_SwitchScreenBuffer();
|
||||
|
||||
error = BasicTerminalBuffer::ResizeTo(width, height, 0);
|
||||
|
||||
fWidth = width;
|
||||
fHeight = height;
|
||||
fCursor = cursor;
|
||||
|
||||
// Switch back.
|
||||
if (!alternateScreenActive)
|
||||
_SwitchScreenBuffer();
|
||||
|
||||
if (error != B_OK) {
|
||||
// This sucks -- we can't do anything about it. Delete the
|
||||
// alternate screen buffer.
|
||||
_FreeLines(fAlternateScreen, oldHeight);
|
||||
fAlternateScreen = NULL;
|
||||
}
|
||||
|
||||
// Switch back.
|
||||
if (!alternateScreenActive)
|
||||
_SwitchScreenBuffer();
|
||||
|
||||
fWidth = width;
|
||||
fHeight = height;
|
||||
fCursor = cursor;
|
||||
}
|
||||
|
||||
return error;
|
||||
|
Loading…
x
Reference in New Issue
Block a user