Skip to content

Commit

Permalink
Fix text color when cursor-color is set (#1901)
Browse files Browse the repository at this point in the history
* Fix text color when cursor color is set

* Add comment
  • Loading branch information
vE5li committed Sep 27, 2023
1 parent 1243dca commit 0532777
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions source/widgets/textbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -555,6 +558,7 @@ static void textbox_draw(widget *wid, cairo_t *draw) {
} else {
cairo_fill(draw);
}
cairo_restore(draw);
}
}

Expand Down

0 comments on commit 0532777

Please sign in to comment.