Fix first history line not being redered during pixel scroll

This commit is contained in:
Kovid Goyal 2026-01-08 20:04:27 +05:30
parent 683b59c876
commit 30ba15e6bc
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 12 additions and 14 deletions

View file

@ -3365,21 +3365,19 @@ update_line_data_blank(unsigned xnum, unsigned int dest_y, uint8_t *data) {
static Line*
render_line_for_virtual_y(Screen *self, int y, Line *line, index_type *lnum, bool *is_history) {
if (self->scrolled_by) {
if (y < (int)self->scrolled_by) {
int idx = (int)self->scrolled_by - 1 - y;
if (idx >= 0 && (unsigned)idx < self->historybuf->count) {
historybuf_init_line(self->historybuf, idx, line);
line->xnum = self->columns;
line->ynum = (index_type)MIN(MAX(y, 0), (int)self->lines - 1);
*lnum = (index_type)idx;
*is_history = true;
return line;
}
return NULL;
if (y < (int)self->scrolled_by) {
int idx = (int)self->scrolled_by - 1 - y;
if (idx >= 0 && (unsigned)idx < self->historybuf->count) {
historybuf_init_line(self->historybuf, idx, line);
line->xnum = self->columns;
line->ynum = (index_type)MIN(MAX(y, 0), (int)self->lines - 1);
*lnum = (index_type)idx;
*is_history = true;
return line;
}
y -= self->scrolled_by;
return NULL;
}
y -= self->scrolled_by;
if (y >= 0 && y < (int)self->lines) {
linebuf_init_line_at(self->linebuf, (index_type)y, line);
*lnum = (index_type)y;

View file

@ -194,7 +194,7 @@ typedef struct {
ExtraCursors extra_cursors;
} Screen;
#define pixel_scroll_enabled(screen) (global_state.opts.pixel_scroll && !screen->paused_rendering.expires_at && screen->linebuf == screen->main_linebuf)
#define pixel_scroll_enabled(screen) (OPT(pixel_scroll) && !screen->paused_rendering.expires_at && screen->linebuf == screen->main_linebuf)
#define render_lines_for_screen(screen) (screen->lines + pixel_scroll_enabled(screen))
void screen_align(Screen*);