diff options
author | vE5li <ve5li@tuta.io> | 2023-09-27 18:23:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-27 18:23:18 +0200 |
commit | 05327773d905adae7871adffdae15554a5616a3c (patch) | |
tree | 033deb77571ad996414f59366200ff7c6a875453 /source | |
parent | 1243dca65b80891851f60661c65570fbd528e6c6 (diff) |
Fix text color when `cursor-color` is set (#1901)
* Fix text color when cursor color is set
* Add comment
Diffstat (limited to 'source')
-rw-r--r-- | source/widgets/textbox.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/source/widgets/textbox.c b/source/widgets/textbox.c index c1f0eabc..59250403 100644 --- a/source/widgets/textbox.c +++ b/source/widgets/textbox.c @@ -540,6 +540,9 @@ static void textbox_draw(widget *wid, cairo_t *draw) { tb->cursor_x_pos = x + cursor_x; } if (tb->blink) { + // This save/restore state is necessary to render the text in the + // correct color when `cursor-color` is set + cairo_save(draw); // use text color as fallback for themes that don't specify the cursor // color rofi_theme_get_color(WIDGET(tb), "cursor-color", draw); @@ -555,6 +558,7 @@ static void textbox_draw(widget *wid, cairo_t *draw) { } else { cairo_fill(draw); } + cairo_restore(draw); } } |