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 window *w = wl->window;
struct layout_cell *lc = wp->layout_cell; struct layout_cell *lc = wp->layout_cell;
struct window_pane *owp;
int wx = w->sx, wy = w->sy, px = lc->sx; 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) { if (strcmp(position, "top-left") == 0) {
xoff = 1; xoff = 1;
@@ -118,15 +119,66 @@ cmd_join_pane_place(struct cmdq_item *item, struct winlink *wl,
strcmp(position, "bottom-right-center") == 0) { strcmp(position, "bottom-right-center") == 0) {
xoff = (3 * wx) / 4 - px / 2; xoff = (3 * wx) / 4 - px / 2;
yoff = (3 * wy) / 4 - py / 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 { } else {
cmdq_error(item, "unknown position: %s", position); cmdq_error(item, "unknown position: %s", position);
return (CMD_RETURN_ERROR); return (CMD_RETURN_ERROR);
} }
lc->xoff = xoff; if (xoff != lc->xoff || yoff != lc->yoff) {
lc->yoff = yoff; lc->xoff = xoff;
layout_fix_panes(w, NULL); lc->yoff = yoff;
notify_window("window-layout-changed", w); layout_fix_panes(w, NULL);
notify_window("window-layout-changed", w);
}
server_redraw_window(w); server_redraw_window(w);
return (CMD_RETURN_NORMAL); 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 '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 '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 '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-left corner' '{' { resize-pane -x50% -y50%; move-pane -P top-left }",
"bind -N 'Move pane to top-right corner' '}' { move-pane -P top-right }", "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-{' { move-pane -P bottom-left }", "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-}' { move-pane -P bottom-right }", "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 'Show messages' '~' { show-messages }",
"bind -N 'Enter copy mode and scroll up' PPage { copy-mode -u }", "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 }", "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 .Ar lines
or or
.Ar columns .Ar columns
(one if omitted); (one if omitted).
.Fl P .Fl P
moves it to moves it to
.Ar position , .Ar position ,
which may be which may be one of:
.Ql top-left , .Bl -column "XXXXXXXXXXXXXXXXXX" "X"
.Ql top-centre , .It Sy "Position" Ta Sy "Meaning"
.Ql top-right , .It Li "top-left" Ta "Top left"
.Ql centre-left , .It Li "top-centre" Ta "Top and horizontal centre"
.Ql centre , .It Li "top-right" Ta "Top right"
.Ql centre-right , .It Li "centre-left" Ta "Vertical centre and left"
.Ql bottom-left , .It Li "centre" Ta "Centre"
.Ql bottom-centre , .It Li "centre-right" Ta "Vertical centre and right"
.Ql bottom-right , .It Li "bottom-left" Ta "Bottom left"
.Ql top-left-centre , .It Li "bottom-centre" Ta "Bottom and horizontal centre"
.Ql top-right-centre , .It Li "bottom-right" Ta "Bottom right"
.Ql bottom-left-centre .It Li "top-left-centre" Ta "Centre of top-left quadrant"
or .It Li "top-right-centre" Ta "Centre of top-right quadrant"
.Ql bottom-right-centre ; .It Li "bottom-left-centre" Ta "Centre of bottom-left quadrant"
for each .It Li "bottom-right-centre" Ta "Centre of botton-right quadrant"
.Ql centre .It Li "front" Ta "Front of floating panes"
position, .It Li "back" Ta "Back of floating panes"
.Ql center .It Li "forward" Ta "Forward one floating pane"
is accepted as an alias. .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 .Fl X
and and
.Fl Y .Fl Y