mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-14 05:33:59 -04:00
osc: set color: update both grids, but exclude scrollback
This commit is contained in:
parent
70c48091f3
commit
c94cbdeb64
2 changed files with 24 additions and 20 deletions
|
|
@ -30,8 +30,8 @@
|
||||||
double forked.
|
double forked.
|
||||||
* Unicode combining character overflow errors are only logged when
|
* Unicode combining character overflow errors are only logged when
|
||||||
debug logging has been enabled.
|
debug logging has been enabled.
|
||||||
* OSC 4 (_Set Color_) now updates already rendered cells in the
|
* OSC 4 (_Set Color_) now updates already rendered cells, excluding
|
||||||
**current** grid (_normal_ or _alternate_).
|
scrollback.
|
||||||
|
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
|
|
||||||
40
osc.c
40
osc.c
|
|
@ -9,6 +9,7 @@
|
||||||
#define LOG_ENABLE_DBG 0
|
#define LOG_ENABLE_DBG 0
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "base64.h"
|
#include "base64.h"
|
||||||
|
#include "grid.h"
|
||||||
#include "render.h"
|
#include "render.h"
|
||||||
#include "selection.h"
|
#include "selection.h"
|
||||||
#include "terminal.h"
|
#include "terminal.h"
|
||||||
|
|
@ -491,27 +492,30 @@ osc_dispatch(struct terminal *term)
|
||||||
* hope that it is unusual with palettes where all the
|
* hope that it is unusual with palettes where all the
|
||||||
* colors aren't unique.
|
* colors aren't unique.
|
||||||
*
|
*
|
||||||
* TODO: we should update *both* grids... but that's
|
* TODO(?): for performance reasons, we only update
|
||||||
* really really slow. Normal usage of this OSC is by
|
* the current screen rows (of both
|
||||||
* full-screen applications using the alt screen.
|
* grids). I.e. scrollback is *not* updates.
|
||||||
*/
|
*/
|
||||||
for (size_t r = 0; r < term->grid->num_rows; r++) {
|
for (size_t i = 0; i < 2; i++) {
|
||||||
struct row *row = term->grid->rows[r];
|
struct grid *grid = i == 0 ? &term->normal : &term->alt;
|
||||||
if (row == NULL)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
for (size_t c = 0; c < term->grid->num_cols; c++) {
|
for (size_t r = 0; r < term->rows; r++) {
|
||||||
struct cell *cell = &row->cells[c];
|
struct row *row = grid_row(grid, r);
|
||||||
if (cell->attrs.have_fg && cell->attrs.fg == term->colors.table[idx]) {
|
assert(row != NULL);
|
||||||
cell->attrs.fg = color;
|
|
||||||
cell->attrs.clean = 0;
|
|
||||||
row->dirty = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cell->attrs.have_bg && cell->attrs.bg == term->colors.table[idx]) {
|
for (size_t c = 0; c < term->grid->num_cols; c++) {
|
||||||
cell->attrs.bg = color;
|
struct cell *cell = &row->cells[c];
|
||||||
cell->attrs.clean = 0;
|
if (cell->attrs.have_fg && cell->attrs.fg == term->colors.table[idx]) {
|
||||||
row->dirty = true;
|
cell->attrs.fg = color;
|
||||||
|
cell->attrs.clean = 0;
|
||||||
|
row->dirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cell->attrs.have_bg && cell->attrs.bg == term->colors.table[idx]) {
|
||||||
|
cell->attrs.bg = color;
|
||||||
|
cell->attrs.clean = 0;
|
||||||
|
row->dirty = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue