Better error reporting when applying custom layouts.

This commit is contained in:
Nicholas Marriott
2022-04-06 14:41:44 +01:00
parent 18105c8ecb
commit 996e54763c
3 changed files with 22 additions and 10 deletions

View File

@ -77,7 +77,7 @@ cmd_select_layout_exec(struct cmd *self, struct cmdq_item *item)
struct window *w = wl->window;
struct window_pane *wp = target->wp;
const char *layoutname;
char *oldlayout;
char *oldlayout, *cause;
int next, previous, layout;
server_unzoom_window(w);
@ -124,8 +124,9 @@ cmd_select_layout_exec(struct cmd *self, struct cmdq_item *item)
}
if (layoutname != NULL) {
if (layout_parse(w, layoutname) == -1) {
cmdq_error(item, "can't set layout: %s", layoutname);
if (layout_parse(w, layoutname, &cause) == -1) {
cmdq_error(item, "%s: %s", cause, layoutname);
free(cause);
goto error;
}
goto changed;