From 5e64c67c252bcc475fa4b155c0480f4da112dda4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Thu, 15 Jul 2021 18:27:10 +0200 Subject: [PATCH] render: search: set clip region Fixes crash when the search box has been reduced in height, due to limited window space. --- CHANGELOG.md | 2 ++ render.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5aa84d9..67cbc32a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,8 @@ rows. * Some box-drawing characters were rendered incorrectly on big-endian architectures. +* Crash when resizing the window to the smallest possible size while + scrollback search is active. * Scrollback indicator being incorrectly rendered when window size is very small. diff --git a/render.c b/render.c index a8809513..7d365643 100644 --- a/render.c +++ b/render.c @@ -2626,6 +2626,12 @@ render_search_box(struct terminal *term) unsigned long cookie = shm_cookie_search(term); struct buffer *buf = shm_get_buffer(term->wl->shm, width, height, cookie, false, 1); + pixman_region32_t clip; + pixman_region32_init_rect(&clip, 0, 0, width, height); + pixman_image_set_clip_region32(buf->pix[0], &clip); + pixman_region32_fini(&clip); + + #define WINDOW_X(x) (margin + x) #define WINDOW_Y(y) (term->height - margin - height + y)