From 5744021ac96b14ec4dc92753973a1c34b8870649 Mon Sep 17 00:00:00 2001 From: nicm Date: Sun, 7 Jun 2026 09:54:25 +0000 Subject: [PATCH] Allow floating panes to be created partially off the window, based on a change from Michael Grant. --- cmd-join-pane.c | 2 +- cmd-split-window.c | 2 +- layout.c | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cmd-join-pane.c b/cmd-join-pane.c index f154a18b..f4fb2ab7 100644 --- a/cmd-join-pane.c +++ b/cmd-join-pane.c @@ -94,7 +94,7 @@ cmd_join_pane_exec(struct cmd *self, struct cmdq_item *item) lc = layout_get_tiled_cell(item, args, dst_w, dst_wp, flags, &cause); if (cause != NULL) { - cmdq_error(item, "%s", cause); + cmdq_error(item, "size or position %s", cause); free(cause); return (CMD_RETURN_ERROR); } diff --git a/cmd-split-window.c b/cmd-split-window.c index 56616591..1408cbe0 100644 --- a/cmd-split-window.c +++ b/cmd-split-window.c @@ -109,7 +109,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, "%s", cause); + cmdq_error(item, "size or position %s", cause); free(cause); return (CMD_RETURN_ERROR); } diff --git a/layout.c b/layout.c index c5b457ff..28c66f1e 100644 --- a/layout.c +++ b/layout.c @@ -1359,30 +1359,30 @@ layout_get_floating_cell(struct cmdq_item *item, struct args *args, struct window *w, __unused struct window_pane *wp, char **cause) { struct layout_cell *lcnew; - u_int sx = w->sx / 2, sy = w->sy / 4; + int sx = w->sx / 2, sy = w->sy / 4; int ox = INT_MAX, oy = INT_MAX; if (args_has(args, 'x')) { - sx = args_percentage_and_expand(args, 'x', 0, USHRT_MAX, w->sx, + sx = args_percentage_and_expand(args, 'x', 0, w->sx - 1, w->sx, item, cause); if (*cause != NULL) return (NULL); } if (args_has(args, 'y')) { - sy = args_percentage_and_expand(args, 'y', 0, USHRT_MAX, w->sy, + sy = args_percentage_and_expand(args, 'y', 0, w->sy - 1, w->sy, item, cause); if (*cause != NULL) return (NULL); } if (args_has(args, 'X')) { - ox = args_percentage_and_expand(args, 'X', 0, USHRT_MAX, w->sx, - item, cause); + ox = args_percentage_and_expand(args, 'X', -sx, w->sx, + w->sx, item, cause); if (*cause != NULL) return (NULL); } if (args_has(args, 'Y')) { - oy = args_percentage_and_expand(args, 'Y', 0, USHRT_MAX, w->sy, - item, cause); + oy = args_percentage_and_expand(args, 'Y', -sy, w->sy, + w->sy, item, cause); if (*cause != NULL) return (NULL); }