Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam
2026-06-13 19:00:06 +01:00
3 changed files with 86 additions and 30 deletions

View File

@@ -67,8 +67,9 @@ 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;
int wx = w->sx, wy = w->sy, px = lc->sx;
int py = lc->sy, xoff, yoff;
int py = lc->sy, xoff = lc->xoff, yoff = lc->yoff;
if (strcmp(position, "top-left") == 0) {
xoff = 1;
@@ -118,15 +119,66 @@ cmd_join_pane_place(struct cmdq_item *item, struct winlink *wl,
strcmp(position, "bottom-right-center") == 0) {
xoff = (3 * wx) / 4 - px / 2;
yoff = (3 * wy) / 4 - py / 2;
} else if (strcmp(position, "front") == 0) {
TAILQ_REMOVE(&w->z_index, wp, zentry);
TAILQ_INSERT_HEAD(&w->z_index, wp, zentry);
} else if (strcmp(position, "back") == 0) {
TAILQ_REMOVE(&w->z_index, wp, zentry);
TAILQ_FOREACH(owp, &w->z_index, zentry) {
if (!window_pane_is_floating(owp))
break;
}
if (owp != NULL)
TAILQ_INSERT_BEFORE(owp, wp, zentry);
else
TAILQ_INSERT_TAIL(&w->z_index, wp, zentry);
} else if (strcmp(position, "forward") == 0) {
owp = TAILQ_PREV(wp, window_panes_zindex, zentry);
if (owp != NULL) {
TAILQ_REMOVE(&w->z_index, wp, zentry);
TAILQ_INSERT_BEFORE(owp, wp, zentry);
}
} else if (strcmp(position, "backward") == 0) {
owp = TAILQ_NEXT(wp, zentry);
if (owp != NULL && window_pane_is_floating(owp)) {
TAILQ_REMOVE(&w->z_index, wp, zentry);
TAILQ_INSERT_AFTER(&w->z_index, owp, wp, zentry);
}
} else if (strcmp(position, "forward-loop") == 0) {
owp = TAILQ_PREV(wp, window_panes_zindex, zentry);
TAILQ_REMOVE(&w->z_index, wp, zentry);
if (owp != NULL)
TAILQ_INSERT_BEFORE(owp, wp, zentry);
else {
TAILQ_FOREACH(owp, &w->z_index, zentry) {
if (!window_pane_is_floating(owp))
break;
}
if (owp != NULL)
TAILQ_INSERT_BEFORE(owp, wp, zentry);
else
TAILQ_INSERT_TAIL(&w->z_index, wp, zentry);
}
} else if (strcmp(position, "backward-loop") == 0) {
owp = TAILQ_NEXT(wp, zentry);
if (owp != NULL && window_pane_is_floating(owp)) {
TAILQ_REMOVE(&w->z_index, wp, zentry);
TAILQ_INSERT_AFTER(&w->z_index, owp, wp, zentry);
} else {
TAILQ_REMOVE(&w->z_index, wp, zentry);
TAILQ_INSERT_HEAD(&w->z_index, wp, zentry);
}
} else {
cmdq_error(item, "unknown position: %s", position);
return (CMD_RETURN_ERROR);
}
lc->xoff = xoff;
lc->yoff = yoff;
layout_fix_panes(w, NULL);
notify_window("window-layout-changed", w);
if (xoff != lc->xoff || yoff != lc->yoff) {
lc->xoff = xoff;
lc->yoff = yoff;
layout_fix_panes(w, NULL);
notify_window("window-layout-changed", w);
}
server_redraw_window(w);
return (CMD_RETURN_NORMAL);

View File

@@ -406,10 +406,10 @@ key_bindings_init(void)
"bind -N 'Choose a window from a list' w { choose-tree -Zw }",
"bind -N 'Kill the active pane' x { confirm-before -p\"kill-pane #P? (y/n)\" kill-pane }",
"bind -N 'Zoom the active pane' z { resize-pane -Z }",
"bind -N 'Move pane to top-left corner' '{' { move-pane -P top-left }",
"bind -N 'Move pane to top-right corner' '}' { move-pane -P top-right }",
"bind -N 'Move pane to bottom-left corner' 'M-{' { move-pane -P bottom-left }",
"bind -N 'Move pane to bottom-right corner' 'M-}' { move-pane -P bottom-right }",
"bind -N 'Move pane to top-left corner' '{' { resize-pane -x50% -y50%; move-pane -P top-left }",
"bind -N 'Move pane to top-right corner' '}' { resize-pane -x50% -y50%; move-pane -P top-right }",
"bind -N 'Move pane to bottom-left corner' 'M-{' { resize-pane -x50% -y50%; move-pane -P bottom-left }",
"bind -N 'Move pane to bottom-right corner' 'M-}' { resize-pane -x50% -y50%; move-pane -P bottom-right }",
"bind -N 'Show messages' '~' { show-messages }",
"bind -N 'Enter copy mode and scroll up' PPage { copy-mode -u }",
"bind -N 'Select the pane above the active pane' -r Up { select-pane -U }",

46
tmux.1
View File

@@ -3339,30 +3339,34 @@ move it down, left, right or up by
.Ar lines
or
.Ar columns
(one if omitted);
(one if omitted).
.Fl P
moves it to
.Ar position ,
which may be
.Ql top-left ,
.Ql top-centre ,
.Ql top-right ,
.Ql centre-left ,
.Ql centre ,
.Ql centre-right ,
.Ql bottom-left ,
.Ql bottom-centre ,
.Ql bottom-right ,
.Ql top-left-centre ,
.Ql top-right-centre ,
.Ql bottom-left-centre
or
.Ql bottom-right-centre ;
for each
.Ql centre
position,
.Ql center
is accepted as an alias.
which may be one of:
.Bl -column "XXXXXXXXXXXXXXXXXX" "X"
.It Sy "Position" Ta Sy "Meaning"
.It Li "top-left" Ta "Top left"
.It Li "top-centre" Ta "Top and horizontal centre"
.It Li "top-right" Ta "Top right"
.It Li "centre-left" Ta "Vertical centre and left"
.It Li "centre" Ta "Centre"
.It Li "centre-right" Ta "Vertical centre and right"
.It Li "bottom-left" Ta "Bottom left"
.It Li "bottom-centre" Ta "Bottom and horizontal centre"
.It Li "bottom-right" Ta "Bottom right"
.It Li "top-left-centre" Ta "Centre of top-left quadrant"
.It Li "top-right-centre" Ta "Centre of top-right quadrant"
.It Li "bottom-left-centre" Ta "Centre of bottom-left quadrant"
.It Li "bottom-right-centre" Ta "Centre of botton-right quadrant"
.It Li "front" Ta "Front of floating panes"
.It Li "back" Ta "Back of floating panes"
.It Li "forward" Ta "Forward one floating pane"
.It Li "backward" Ta "Backward one floating pane"
.It Li "forward-loop" Ta "Forward but back if already at front"
.It Li "backward-loop" Ta "Backward but front if already at back"
.El
.Pp
.Fl X
and
.Fl Y