From b7d12de0a7024454ff65f6e5f5f94cc41dcde205 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 25 Feb 2020 14:49:17 +0530 Subject: [PATCH] Avoid transitions in line_as_ansi on marks --- kitty/data-types.h | 1 + kitty/line.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/kitty/data-types.h b/kitty/data-types.h index edba314fa..de2663ff0 100644 --- a/kitty/data-types.h +++ b/kitty/data-types.h @@ -71,6 +71,7 @@ typedef enum { TILING, SCALED, MIRRORED } BackgroundImageLayout; #define DIM_SHIFT 8 #define MARK_SHIFT 9 #define ATTRS_MASK_WITHOUT_MARK 0xf9ff +#define ATTRS_MASK_FOR_SGR (ATTRS_MASK_WITHOUT_MARK | ATTRS_MASK_WITHOUT_WIDTH) #define MARK_MASK 3 #define COL_MASK 0xFFFFFFFF #define UTF8_ACCEPT 0 diff --git a/kitty/line.c b/kitty/line.c index e1d6db78a..c25391de6 100644 --- a/kitty/line.c +++ b/kitty/line.c @@ -298,7 +298,7 @@ line_as_ansi(Line *self, Py_UCS4 *buf, index_type buflen, bool *truncated, const cell = &self->gpu_cells[pos]; -#define CMP_ATTRS (cell->attrs & ATTRS_MASK_WITHOUT_WIDTH) != ((*prev_cell)->attrs & ATTRS_MASK_WITHOUT_WIDTH) +#define CMP_ATTRS (cell->attrs & ATTRS_MASK_FOR_SGR) != ((*prev_cell)->attrs & ATTRS_MASK_FOR_SGR) #define CMP(x) cell->x != (*prev_cell)->x if (CMP_ATTRS || CMP(fg) || CMP(bg) || CMP(decoration_fg)) { const char *sgr = cell_as_sgr(cell, *prev_cell);