Do nothing if move-pane -P does not change the pane.

This commit is contained in:
Michael Grant
2026-10-03 22:20:57 +01:00
parent 636826f3b4
commit 37b640012a

View File

@@ -128,7 +128,7 @@ cmd_join_pane_place(struct cmdq_item *item, struct winlink *wl,
{
struct window *w = wl->window;
struct layout_cell *lc = wp->layout_cell;
struct window_pane *owp;
struct window_pane *owp, *prev;
int wx = w->sx, wy = w->sy;
int px = lc->g.sx, py = lc->g.sy;
int xoff = lc->g.xoff, yoff = lc->g.yoff;
@@ -136,6 +136,7 @@ cmd_join_pane_place(struct cmdq_item *item, struct winlink *wl,
if (window_pane_get_pane_lines(wp) == PANE_LINES_NONE)
border = 0;
prev = TAILQ_PREV(wp, window_panes_zindex, zentry);
if (strcmp(position, "top-left") == 0) {
xoff = border;
@@ -220,6 +221,11 @@ cmd_join_pane_place(struct cmdq_item *item, struct winlink *wl,
return (CMD_RETURN_ERROR);
}
/* Do nothing if the pane did not move, as when raising the top pane. */
if (xoff == lc->g.xoff && yoff == lc->g.yoff &&
TAILQ_PREV(wp, window_panes_zindex, zentry) == prev)
return (CMD_RETURN_NORMAL);
if (xoff != lc->g.xoff || yoff != lc->g.yoff) {
lc->g.xoff = xoff;
lc->g.yoff = yoff;