Broken term scrolling
This commit is contained in:
@@ -23,6 +23,8 @@ uint8_t* glyphs = _binary_zap_light16_psf_start + sizeof(PSF1_Header);
|
||||
#define FONT_WIDTH 8
|
||||
#define FONT_HEIGHT font->characterSize
|
||||
|
||||
|
||||
|
||||
// Character cursor
|
||||
typedef struct
|
||||
{
|
||||
@@ -102,7 +104,7 @@ static void erase_char(size_t px, size_t py)
|
||||
|
||||
for (size_t y=0; y<FONT_HEIGHT; y++)
|
||||
{
|
||||
for (size_t x=0; x<FONT_HEIGHT; x++)
|
||||
for (size_t x=0; x<FONT_WIDTH; x++)
|
||||
{
|
||||
// Black
|
||||
putpixel(px+x, py+y, 0);
|
||||
@@ -112,21 +114,15 @@ static void erase_char(size_t px, size_t py)
|
||||
|
||||
void term_scroll()
|
||||
{
|
||||
const size_t row_height = FONT_HEIGHT;
|
||||
const size_t row_bytes = framebuffer->pitch;
|
||||
const size_t screen_rows = framebuffer->height;
|
||||
// Erase first text line
|
||||
memset(fb, 255, FONT_HEIGHT*framebuffer->pitch);
|
||||
|
||||
// Move framebuffer up by one text row
|
||||
//memmove(fb, fb + row_height * row_bytes, (screen_rows - row_height) * row_bytes);
|
||||
// Move whole framebuffer up by one text line
|
||||
memmove(fb, fb+(FONT_HEIGHT*framebuffer->pitch), (framebuffer->height-FONT_HEIGHT)*framebuffer->pitch);
|
||||
|
||||
for (size_t i = 0; i < (screen_rows - row_height) * row_bytes; i++)
|
||||
{
|
||||
fb[i] = fb[i + row_height * row_bytes];
|
||||
}
|
||||
|
||||
// Clear last text row
|
||||
size_t clear_start = (screen_rows - row_height) * row_bytes;
|
||||
memset(fb + clear_start, 0, row_height * row_bytes);
|
||||
// Clear last text line
|
||||
size_t clear_start = (framebuffer->height - FONT_HEIGHT) * framebuffer->pitch;
|
||||
memset(fb + clear_start, 255, FONT_HEIGHT * framebuffer->pitch);
|
||||
|
||||
// Shift line lengths by 1 (for backspace handling)
|
||||
size_t max_lines = term_max_lines();
|
||||
@@ -134,11 +130,9 @@ void term_scroll()
|
||||
{
|
||||
lines_length[i - 1] = lines_length[i];
|
||||
}
|
||||
|
||||
lines_length[max_lines - 1] = 0;
|
||||
}
|
||||
|
||||
|
||||
void putchar(char c)
|
||||
{
|
||||
const size_t max_cols = term_max_cols();
|
||||
|
||||
Reference in New Issue
Block a user