Better error reporting when applying custom layouts.

This commit is contained in:
nicm
2022-05-30 12:52:02 +00:00
parent cd692b5a68
commit 4ae2c64657
2 changed files with 21 additions and 9 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;