Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam
2026-06-16 10:15:14 +01:00
4 changed files with 47 additions and 26 deletions

View File

@@ -61,7 +61,7 @@ cmd_new_window_exec(struct cmd *self, struct cmdq_item *item)
struct session *s = target->s; struct session *s = target->s;
struct winlink *wl = target->wl, *new_wl = NULL; struct winlink *wl = target->wl, *new_wl = NULL;
int idx = target->idx, before; int idx = target->idx, before;
char *cause = NULL, *cp, *expanded, *wname; char *cause = NULL, *cp, *expanded, *wname = NULL;
const char *template, *name; const char *template, *name;
struct cmd_find_state fs; struct cmd_find_state fs;
struct args_value *av; struct args_value *av;

View File

@@ -226,6 +226,7 @@ cmd_resize_pane_mouse_update_floating(struct client *c, struct mouse_event *m)
struct window_pane *wp; struct window_pane *wp;
struct layout_cell *lc; struct layout_cell *lc;
int y, ly, x, lx, sx, sy, new_sx, new_sy; int y, ly, x, lx, sx, sy, new_sx, new_sy;
int scrollbars, sb_pos, left, right;
int new_xoff, new_yoff, resizes = 0; int new_xoff, new_yoff, resizes = 0;
wp = cmd_mouse_pane(m, NULL, &wl); wp = cmd_mouse_pane(m, NULL, &wl);
@@ -237,6 +238,17 @@ cmd_resize_pane_mouse_update_floating(struct client *c, struct mouse_event *m)
lc = wp->layout_cell; lc = wp->layout_cell;
sx = wp->sx; sx = wp->sx;
sy = wp->sy; sy = wp->sy;
scrollbars = options_get_number(w->options, "pane-scrollbars");
sb_pos = options_get_number(w->options, "pane-scrollbars-position");
left = wp->xoff - 1;
right = wp->xoff + sx;
if (window_pane_show_scrollbar(wp, scrollbars) &&
sb_pos == PANE_SCROLLBARS_LEFT) {
left -= wp->scrollbar_style.width + wp->scrollbar_style.pad;
} else if (window_pane_show_scrollbar(wp, scrollbars) &&
sb_pos == PANE_SCROLLBARS_RIGHT) {
right += wp->scrollbar_style.width + wp->scrollbar_style.pad;
}
y = m->y + m->oy; x = m->x + m->ox; y = m->y + m->oy; x = m->x + m->ox;
if (m->statusat == 0 && y >= (int)m->statuslines) if (m->statusat == 0 && y >= (int)m->statuslines)
@@ -249,7 +261,7 @@ cmd_resize_pane_mouse_update_floating(struct client *c, struct mouse_event *m)
else if (m->statusat > 0 && ly >= m->statusat) else if (m->statusat > 0 && ly >= m->statusat)
ly = m->statusat - 1; ly = m->statusat - 1;
if ((lx == wp->xoff - 1 || lx == wp->xoff) && ly == wp->yoff - 1) { if ((lx == left || lx == left + 1) && ly == wp->yoff - 1) {
/* Top left corner. */ /* Top left corner. */
new_sx = lc->sx + (lx - x); new_sx = lc->sx + (lx - x);
if (new_sx < PANE_MINIMUM) if (new_sx < PANE_MINIMUM)
@@ -261,7 +273,7 @@ cmd_resize_pane_mouse_update_floating(struct client *c, struct mouse_event *m)
new_yoff = y + 1; new_yoff = y + 1;
layout_set_size(lc, new_sx, new_sy, new_xoff, new_yoff); layout_set_size(lc, new_sx, new_sy, new_xoff, new_yoff);
resizes++; resizes++;
} else if ((lx == wp->xoff + sx + 1 || lx == wp->xoff + sx) && } else if ((lx == right + 1 || lx == right) &&
ly == wp->yoff - 1) { ly == wp->yoff - 1) {
/* Top right corner. */ /* Top right corner. */
new_sx = x - lc->xoff; new_sx = x - lc->xoff;
@@ -273,7 +285,7 @@ cmd_resize_pane_mouse_update_floating(struct client *c, struct mouse_event *m)
new_yoff = y + 1; new_yoff = y + 1;
layout_set_size(lc, new_sx, new_sy, lc->xoff, new_yoff); layout_set_size(lc, new_sx, new_sy, lc->xoff, new_yoff);
resizes++; resizes++;
} else if ((lx == wp->xoff - 1 || lx == wp->xoff) && } else if ((lx == left || lx == left + 1) &&
ly == wp->yoff + sy) { ly == wp->yoff + sy) {
/* Bottom left corner. */ /* Bottom left corner. */
new_sx = lc->sx + (lx - x); new_sx = lc->sx + (lx - x);
@@ -285,7 +297,7 @@ cmd_resize_pane_mouse_update_floating(struct client *c, struct mouse_event *m)
new_xoff = x + 1; new_xoff = x + 1;
layout_set_size(lc, new_sx, new_sy, new_xoff, lc->yoff); layout_set_size(lc, new_sx, new_sy, new_xoff, lc->yoff);
resizes++; resizes++;
} else if ((lx == wp->xoff + sx + 1 || lx == wp->xoff + sx) && } else if ((lx == right + 1 || lx == right) &&
ly == wp->yoff + sy) { ly == wp->yoff + sy) {
/* Bottom right corner. */ /* Bottom right corner. */
new_sx = x - lc->xoff; new_sx = x - lc->xoff;
@@ -296,14 +308,14 @@ cmd_resize_pane_mouse_update_floating(struct client *c, struct mouse_event *m)
new_sy = PANE_MINIMUM; new_sy = PANE_MINIMUM;
layout_set_size(lc, new_sx, new_sy, lc->xoff, lc->yoff); layout_set_size(lc, new_sx, new_sy, lc->xoff, lc->yoff);
resizes++; resizes++;
} else if (lx == wp->xoff + sx + 1) { } else if (lx == right) {
/* Right border. */ /* Right border. */
new_sx = x - lc->xoff; new_sx = x - lc->xoff;
if (new_sx < PANE_MINIMUM) if (new_sx < PANE_MINIMUM)
return; return;
layout_set_size(lc, new_sx, lc->sy, lc->xoff, lc->yoff); layout_set_size(lc, new_sx, lc->sy, lc->xoff, lc->yoff);
resizes++; resizes++;
} else if (lx == wp->xoff - 1) { } else if (lx == left) {
/* Left border. */ /* Left border. */
new_sx = lc->sx + (lx - x); new_sx = lc->sx + (lx - x);
if (new_sx < PANE_MINIMUM) if (new_sx < PANE_MINIMUM)

View File

@@ -129,7 +129,7 @@ screen_redraw_pane_border(struct screen_redraw_ctx *ctx, struct window_pane *wp,
int hsplit = 0, vsplit = 0; int hsplit = 0, vsplit = 0;
int pane_status = window_pane_get_pane_status(wp); int pane_status = window_pane_get_pane_status(wp);
int pane_scrollbars = ctx->pane_scrollbars, sb_w = 0; int pane_scrollbars = ctx->pane_scrollbars, sb_w = 0;
int sb_pos, sx = wp->sx, sy = wp->sy; int sb_pos, sx = wp->sx, sy = wp->sy, left, right;
enum layout_type split_type; enum layout_type split_type;
if (pane_scrollbars != 0) if (pane_scrollbars != 0)
@@ -151,20 +151,19 @@ screen_redraw_pane_border(struct screen_redraw_ctx *ctx, struct window_pane *wp,
/* Floating pane borders. */ /* Floating pane borders. */
if (window_pane_is_floating(wp)) { if (window_pane_is_floating(wp)) {
left = wp->xoff - 1;
right = wp->xoff + sx;
if (sb_pos == PANE_SCROLLBARS_LEFT)
left -= sb_w;
else
right += sb_w;
if (py >= wp->yoff - 1 && py <= wp->yoff + sy) { if (py >= wp->yoff - 1 && py <= wp->yoff + sy) {
if (sb_pos == PANE_SCROLLBARS_LEFT) { if (px == left)
if (px == wp->xoff - 1 - sb_w) return (SCREEN_REDRAW_BORDER_LEFT);
return (SCREEN_REDRAW_BORDER_LEFT); if (px == right)
if (px == wp->xoff + sx) return (SCREEN_REDRAW_BORDER_RIGHT);
return (SCREEN_REDRAW_BORDER_RIGHT);
} else { /* PANE_SCROLLBARS_RIGHT or none. */
if (px == wp->xoff - 1)
return (SCREEN_REDRAW_BORDER_LEFT);
if (px == wp->xoff + sx + sb_w)
return (SCREEN_REDRAW_BORDER_RIGHT);
}
} }
if (px >= wp->xoff && px <= wp->xoff + sx) { if (px > left && px <= right) {
if (py == wp->yoff - 1) if (py == wp->yoff - 1)
return (SCREEN_REDRAW_BORDER_TOP); return (SCREEN_REDRAW_BORDER_TOP);
if (py == wp->yoff + sy) if (py == wp->yoff + sy)

View File

@@ -627,6 +627,9 @@ server_client_check_mouse_in_pane(struct window_pane *wp, int px, int py,
pane_status_line = wp->yoff + wp->sy; pane_status_line = wp->yoff + wp->sy;
else else
pane_status_line = -1; /* not used */ pane_status_line = -1; /* not used */
bdr_left = wp->xoff - 1;
if (sb_pos == PANE_SCROLLBARS_LEFT)
bdr_left -= sb_pad + sb_w;
/* Check if point is within the pane or scrollbar. */ /* Check if point is within the pane or scrollbar. */
if (((pane_status != PANE_STATUS_OFF && if (((pane_status != PANE_STATUS_OFF &&
@@ -657,7 +660,7 @@ server_client_check_mouse_in_pane(struct window_pane *wp, int px, int py,
return (KEYC_MOUSE_LOCATION_SCROLLBAR_DOWN); return (KEYC_MOUSE_LOCATION_SCROLLBAR_DOWN);
} else if (window_pane_is_floating(wp) && } else if (window_pane_is_floating(wp) &&
window_pane_get_pane_lines(wp) != PANE_LINES_NONE && window_pane_get_pane_lines(wp) != PANE_LINES_NONE &&
(px == wp->xoff - 1 || (px == bdr_left ||
py == wp->yoff - 1 || py == wp->yoff - 1 ||
py == wp->yoff + (int)wp->sy)) { py == wp->yoff + (int)wp->sy)) {
/* Floating pane left, bottom or top border. */ /* Floating pane left, bottom or top border. */
@@ -675,11 +678,20 @@ server_client_check_mouse_in_pane(struct window_pane *wp, int px, int py,
if (window_pane_is_floating(fwp) && if (window_pane_is_floating(fwp) &&
window_pane_get_pane_lines(fwp) == PANE_LINES_NONE) window_pane_get_pane_lines(fwp) == PANE_LINES_NONE)
continue; continue;
if (window_pane_show_scrollbar(fwp, sb)) {
sb_w = fwp->scrollbar_style.width;
sb_pad = fwp->scrollbar_style.pad;
} else {
sb_w = 0;
sb_pad = 0;
}
bdr_top = fwp->yoff - 1; bdr_top = fwp->yoff - 1;
bdr_bottom = fwp->yoff + fwp->sy; bdr_bottom = fwp->yoff + fwp->sy;
if (sb_pos == PANE_SCROLLBARS_LEFT) bdr_left = fwp->xoff - 1;
if (sb_pos == PANE_SCROLLBARS_LEFT) {
bdr_left -= sb_pad + sb_w;
bdr_right = fwp->xoff + fwp->sx; bdr_right = fwp->xoff + fwp->sx;
else { } else {
/* PANE_SCROLLBARS_RIGHT or none. */ /* PANE_SCROLLBARS_RIGHT or none. */
bdr_right = fwp->xoff + fwp->sx + sb_pad + sb_w; bdr_right = fwp->xoff + fwp->sx + sb_pad + sb_w;
} }
@@ -689,13 +701,11 @@ server_client_check_mouse_in_pane(struct window_pane *wp, int px, int py,
break; break;
if (window_pane_is_floating(wp)) { if (window_pane_is_floating(wp)) {
/* Floating pane, check left border. */ /* Floating pane, check left border. */
bdr_left = fwp->xoff - 1;
if (px == bdr_left) if (px == bdr_left)
break; break;
} }
} }
if (px >= fwp->xoff - 1 && if (px >= bdr_left && px <= fwp->xoff + (int)fwp->sx) {
px <= fwp->xoff + (int)fwp->sx) {
bdr_bottom = fwp->yoff + fwp->sy; bdr_bottom = fwp->yoff + fwp->sy;
if (py == bdr_bottom) if (py == bdr_bottom)
break; break;