fix copy onto incorrect buffer

This commit is contained in:
Kovid Goyal 2024-01-02 15:05:25 +05:30
parent f596351bc1
commit ab919f6fa1
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 11 additions and 18 deletions

View file

@ -2406,7 +2406,7 @@ screen_pause_rendering(Screen *self, bool pause, int for_in_ms) {
for (index_type y = 0; y < self->lines; y++) {
Line *src = visual_line_(self, y);
linebuf_init_line(self->paused_rendering.linebuf, y);
copy_line(src, self->linebuf->line);
copy_line(src, self->paused_rendering.linebuf->line);
self->paused_rendering.linebuf->line_attrs[y] = src->attrs;
}
copy_selections(&self->paused_rendering.selections, &self->selections);

View file

@ -389,44 +389,37 @@ cell_prepare_to_render(ssize_t vao_idx, Screen *screen, GLfloat xstart, GLfloat
bool disable_ligatures = screen->disable_ligatures == DISABLE_LIGATURES_CURSOR;
bool screen_resized = screen->last_rendered.columns != screen->columns || screen->last_rendered.lines != screen->lines;
#define update_cell_data \
#define update_cell_data { \
sz = sizeof(GPUCell) * screen->lines * screen->columns; \
address = alloc_and_map_vao_buffer(vao_idx, sz, cell_data_buffer, GL_STREAM_DRAW, GL_WRITE_ONLY); \
screen_update_cell_data(screen, address, fonts_data, disable_ligatures && cursor_pos_changed); \
unmap_vao_buffer(vao_idx, cell_data_buffer); address = NULL; \
changed = true;
changed = true; \
}
if (screen->paused_rendering.expires_at) {
if (!screen->paused_rendering.cell_data_updated) {
update_cell_data;
}
} else if (screen->reload_all_gpu_data || screen->scroll_changed || screen->is_dirty || screen_resized || (disable_ligatures && cursor_pos_changed)) {
update_cell_data;
}
if (!screen->paused_rendering.cell_data_updated) update_cell_data;
} else if (screen->reload_all_gpu_data || screen->scroll_changed || screen->is_dirty || screen_resized || (disable_ligatures && cursor_pos_changed)) update_cell_data;
if (cursor_pos_changed) {
screen->last_rendered.cursor_x = cursor->x;
screen->last_rendered.cursor_y = cursor->y;
}
#define update_selection_data \
#define update_selection_data { \
sz = (size_t)screen->lines * screen->columns; \
address = alloc_and_map_vao_buffer(vao_idx, sz, selection_buffer, GL_STREAM_DRAW, GL_WRITE_ONLY); \
screen_apply_selection(screen, address, sz); \
unmap_vao_buffer(vao_idx, selection_buffer); address = NULL; \
changed = true;
changed = true; \
}
if (screen->paused_rendering.expires_at) {
if (!screen->paused_rendering.cell_data_updated) {
update_selection_data;
}
if (!screen->paused_rendering.cell_data_updated) update_selection_data;
screen->paused_rendering.cell_data_updated = true;
screen->last_rendered.scrolled_by = screen->paused_rendering.scrolled_by;
} else {
if (screen->reload_all_gpu_data || screen_resized || screen_is_selection_dirty(screen)) {
update_selection_data;
}
if (screen->reload_all_gpu_data || screen_resized || screen_is_selection_dirty(screen)) update_selection_data;
if (grman_update_layers(screen->grman, screen->scrolled_by, xstart, ystart, dx, dy, screen->columns, screen->lines, screen->cell_size)) {
changed = true;
}