render: search: set clip region

Fixes crash when the search box has been reduced in height, due to
limited window space.
This commit is contained in:
Daniel Eklöf 2021-07-15 18:27:10 +02:00
parent 628fd39098
commit 5e64c67c25
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 8 additions and 0 deletions

View file

@ -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.

View file

@ -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)