diff --git a/render.c b/render.c index b58eb7dc..2386e073 100644 --- a/render.c +++ b/render.c @@ -950,9 +950,21 @@ render_resize(struct terminal *term, int width, int height) } void -render_set_title(struct terminal *term, const char *title) +render_set_title(struct terminal *term, const char *_title) { + /* TODO: figure out what the limit actually is */ + static const size_t max_len = 100; + + const char *title = _title; + char *copy = NULL; + + if (strlen(title) > max_len) { + copy = strndup(_title, max_len); + title = copy; + } + xdg_toplevel_set_title(term->window->xdg_toplevel, title); + free(copy); } void