aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2024-07-13 08:19:53 +0000
committerDaniel Eklöf <daniel@ekloef.se>2024-07-13 08:30:23 +0000
commitc46c124363fad6dabd8328bdf8e15e5da8fabf7e (patch)
tree13907132e075f97ac95f396595c9a38d522fa386
parentthemes: add nvim-dark and nvim-light themes (diff)
render: cursor: use default fg/bg if cell fg/bg are the same
When deciding which colors to use for the cursor, and the cursor text and background colors are the same, use the default fg/bg instead. Closes #1761
-rw-r--r--CHANGELOG.md6
-rw-r--r--render.c8
2 files changed, 14 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 39c95231..12bac7be 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -84,8 +84,14 @@
In other words, if, after this change, `XTGETTCAP` returns a string
that is different compared to `tigetstr()`, then it is likely a bug
in foot's implementation of `XTGETTCAP`.
+* If the cursor foreground and background colors are identical (for
+ example, when cursor uses inverted colors and the cell's foreground
+ and background are the same), the cursor will instead be rendered
+ using the default foreground and background colors, inverted
+ ([#1761][1761]).
[1701]: https://codeberg.org/dnkl/foot/issues/1701
+[1761]: https://codeberg.org/dnkl/foot/issues/1761
### Deprecated
diff --git a/render.c b/render.c
index 2f18ff88..fd078184 100644
--- a/render.c
+++ b/render.c
@@ -573,6 +573,14 @@ cursor_colors_for_cell(const struct terminal *term, const struct cell *cell,
*text_color = color_hex_to_pixman(term->colors.bg);
}
}
+
+ if (text_color->red == cursor_color->red &&
+ text_color->green == cursor_color->green &&
+ text_color->blue == cursor_color->blue)
+ {
+ *text_color = color_hex_to_pixman(term->colors.bg);
+ *cursor_color = color_hex_to_pixman(term->colors.fg);
+ }
}
static void