1
0
mirror of https://github.com/openbsd/src.git synced 2026-06-17 23:03:29 +02:00

Tidy up error messages from split-window.

This commit is contained in:
nicm
2026-06-13 18:30:16 +00:00
parent a103b0d729
commit 5f43b24e5e
2 changed files with 24 additions and 11 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: cmd-split-window.c,v 1.132 2026/06/13 08:59:52 nicm Exp $ */
/* $OpenBSD: cmd-split-window.c,v 1.133 2026/06/13 18:30:16 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -120,7 +120,7 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item)
else
lc = layout_get_tiled_cell(item, args, w, wp, flags, &cause);
if (cause != NULL) {
cmdq_error(item, "size or position %s", cause);
cmdq_error(item, "%s", cause);
free(cause);
return (CMD_RETURN_ERROR);
}
+22 -9
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: layout.c,v 1.64 2026/06/11 10:16:19 nicm Exp $ */
/* $OpenBSD: layout.c,v 1.65 2026/06/13 18:30:16 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1416,30 +1416,43 @@ layout_get_floating_cell(struct cmdq_item *item, struct args *args,
struct layout_cell *lcnew;
int sx = w->sx / 2, sy = w->sy / 4;
int ox = INT_MAX, oy = INT_MAX;
char *error;
if (args_has(args, 'x')) {
sx = args_percentage_and_expand(args, 'x', 0, w->sx - 1, w->sx,
item, cause);
if (*cause != NULL)
item, &error);
if (error != NULL) {
xasprintf(cause, "position %s", error);
free(error);
return (NULL);
}
}
if (args_has(args, 'y')) {
sy = args_percentage_and_expand(args, 'y', 0, w->sy - 1, w->sy,
item, cause);
if (*cause != NULL)
item, &error);
if (error != NULL) {
xasprintf(cause, "position %s", error);
free(error);
return (NULL);
}
}
if (args_has(args, 'X')) {
ox = args_percentage_and_expand(args, 'X', -sx, w->sx,
w->sx, item, cause);
if (*cause != NULL)
w->sx, item, &error);
if (error != NULL) {
xasprintf(cause, "size %s", error);
free(error);
return (NULL);
}
}
if (args_has(args, 'Y')) {
oy = args_percentage_and_expand(args, 'Y', -sy, w->sy,
w->sy, item, cause);
if (*cause != NULL)
w->sy, item, &error);
if (error != NULL) {
xasprintf(cause, "size %s", error);
free(error);
return (NULL);
}
}
if (ox == INT_MAX) {