aboutsummaryrefslogtreecommitdiff
path: root/render.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-12-03 19:19:50 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-12-03 19:19:50 +0000
commitb0d555255cc7ba44241a064e5595f1e935d16e4d (patch)
tree04992c57a354ce3b65b209e9ebb385e01ab0d1f2 /render.c
parentMerge branch 'scrollback-search-extend-to-end-of-word' (diff)
render: limit size of search surface to parent window
This shouldn't be necessary, but Sway acts up when the subsurface exceeds the parent surface (window, in this case) size, and extends the window size (if floating), leaving it with no content
Diffstat (limited to 'render.c')
-rw-r--r--render.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/render.c b/render.c
index ccae7d25..5f11983a 100644
--- a/render.c
+++ b/render.c
@@ -747,12 +747,10 @@ render_search_box(struct terminal *term)
{
assert(term->window->search_sub_surface != NULL);
- /* TODO: at least sway allows the subsurface to extend outside the
- * main window. Do we want that? */
const int scale = term->scale >= 1 ? term->scale : 1;
const int margin = scale * 3;
- const int width = 2 * margin + max(20, term->search.len) * term->cell_width;
- const int height = 2 * margin + 1 * term->cell_height;
+ const int width = min(term->width, 2 * margin + max(20, term->search.len) * term->cell_width);
+ const int height = min(term->height, 2 * margin + 1 * term->cell_height);
unsigned long cookie = (uintptr_t)term;
struct buffer *buf = shm_get_buffer(term->wl->shm, width, height, cookie);