From 82d4c237d1f501cd7b0b8afc53ed87fd3ccf0e18 Mon Sep 17 00:00:00 2001 From: Phil Jones Date: Fri, 29 Jul 2022 12:44:02 +0100 Subject: Add --selection-padding option. This adds some extra padding in the selection background, rather than tightly wrapping the selection text. --- src/entry_backend/harfbuzz.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/entry_backend/harfbuzz.c') diff --git a/src/entry_backend/harfbuzz.c b/src/entry_backend/harfbuzz.c index af1aad7..db3be66 100644 --- a/src/entry_backend/harfbuzz.c +++ b/src/entry_backend/harfbuzz.c @@ -257,7 +257,10 @@ void entry_backend_harfbuzz_update(struct entry *entry) cairo_save(cr); color = entry->selection_background_color; cairo_set_source_rgba(cr, color.r, color.g, color.b, color.a); - cairo_rectangle(cr, 0, 0, width, font_extents.height); + uint32_t pad = entry->selection_background_padding; + cairo_translate(cr, -pad, 0); + cairo_rectangle(cr, 0, 0, width + pad * 2, font_extents.height); + cairo_translate(cr, pad, 0); cairo_fill(cr); cairo_restore(cr); cairo_paint(cr); -- cgit v1.2.3