scrolling bug fix

This commit is contained in:
Julian Barathieu 2019-05-18 19:56:10 +02:00
parent 247d8feeec
commit 8d23c076eb
2 changed files with 21 additions and 7 deletions

View File

@ -43,10 +43,10 @@ error_t bvgaflusher(Buffer_t *buf)
ushort *fbp = BtVideoInfo.framebufferAddr; ushort *fbp = BtVideoInfo.framebufferAddr;
uchar color = 0xf; uchar color = 0xf;
uchar *currentLine = buf->wp - buf->lineLen - buf->lastLF; uchar *currentLine = buf->wp - buf->lastLF;
uchar *bufStart = (uchar *)lmax((size_t)buf->buf, uchar *bufStart = (uchar *)lmax((size_t)buf->buf,
(size_t)currentLine (size_t)currentLine
- (buf->nLines - 2 + bscroll) * buf->lineLen); - (buf->nLines - 1 + bscroll) * buf->lineLen);
uchar *ptr = bufStart; uchar *ptr = bufStart;
@ -87,10 +87,21 @@ void IoScrollDown(void)
void IoScrollUp(void) void IoScrollUp(void)
{ {
// Keep the 8 below the 10 given to BOpenTermBufEx BLockBuf(BStdOut);
if (bscroll < BtVideoInfo.framebufferHeight * 8) /* XXX */
uchar *currentLine = BStdOut->wp - BStdOut->lastLF;
assert(currentLine >= BStdOut->buf);
// Scrollable lines
uint scrabble = max(0, (currentLine-BStdOut->buf)/BStdOut->lineLen
- BStdOut->nLines + 1);
if (bscroll < scrabble)
bscroll++; bscroll++;
bvgaflusher(BStdOut); bvgaflusher(BStdOut);
BUnlockBuf(BStdOut);
} }

View File

@ -65,9 +65,12 @@ error_t CmdHelp(int argc, char **argv, char *cmdline)
error_t CmdClear(int argc, char **argv, char *cmdline) error_t CmdClear(int argc, char **argv, char *cmdline)
{ {
size_t i; BLockBuf(BStdOut);
for (i = 0; i < BtVideoInfo.framebufferHeight; i++)
KernLog("\n"); BStdOut->wp = BStdOut->rp = BStdOut->buf;
BStdOut->lastLF = 0;
BUnlockBuf(BStdOut);
return EOK; return EOK;
} }