mirror of
https://github.com/justinian/jsix.git
synced 2025-12-09 16:04:32 -08:00
[fb] Fix fb log scrolling
While working on the double-buffering issue, I ripped out this feature from scrollback and didn't put it back in. Also having main allocate extra space for the message buffer since calling malloc/free over again several times was causing malloc to panic. (Which should also separately be fixed..)
This commit is contained in:
@@ -92,7 +92,7 @@ main(int argc, const char **argv)
|
||||
scrollback scroll(rows, cols);
|
||||
|
||||
int pending = 0;
|
||||
constexpr int pending_threshold = 10;
|
||||
constexpr int pending_threshold = 5;
|
||||
|
||||
j6_handle_t sys = __handle_sys;
|
||||
size_t buffer_size = 0;
|
||||
@@ -104,7 +104,7 @@ main(int argc, const char **argv)
|
||||
|
||||
if (s == j6_err_insufficient) {
|
||||
free(message_buffer);
|
||||
message_buffer = malloc(size);
|
||||
message_buffer = malloc(size * 2);
|
||||
buffer_size = size;
|
||||
continue;
|
||||
} else if (s != j6_status_ok) {
|
||||
|
||||
@@ -45,8 +45,12 @@ scrollback::render(screen &scr, font &fnt)
|
||||
const unsigned xstride = (m_margin + fnt.width());
|
||||
const unsigned ystride = (m_margin + fnt.height());
|
||||
|
||||
unsigned start = m_count <= m_rows ? 0 :
|
||||
m_count % m_rows;
|
||||
|
||||
for (unsigned y = 0; y < m_rows; ++y) {
|
||||
char *line = &m_data[y*m_cols];
|
||||
unsigned i = (start + y) % m_rows;
|
||||
char *line = &m_data[i*m_cols];
|
||||
for (unsigned x = 0; x < m_cols; ++x) {
|
||||
fnt.draw_glyph(scr, line[x], fg, bg, m_margin+x*xstride, m_margin+y*ystride);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user