mirror of
https://github.com/tmux/tmux.git
synced 2026-07-26 02:21:54 +00:00
Merge remote-tracking branch 'refs/remotes/tmux-openbsd/master'
* refs/remotes/tmux-openbsd/master: Remove the active-pane flag for now, there are some gaps in how this works and I don't like it. May come back in a different form (maybe just for windows).
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: cmd-find.c,v 1.86 2026/07/02 08:47:25 nicm Exp $ */
|
||||
/* $OpenBSD: cmd-find.c,v 1.87 2026/07/17 12:42:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2015 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@@ -884,7 +884,7 @@ cmd_find_from_client(struct cmd_find_state *fs, struct client *c, int flags)
|
||||
if (c->session != NULL) {
|
||||
cmd_find_clear_state(fs, flags);
|
||||
|
||||
fs->wp = server_client_get_pane(c);
|
||||
fs->wp = c->session->curw->window->active;
|
||||
if (fs->wp == NULL) {
|
||||
cmd_find_from_session(fs, c->session, flags);
|
||||
return (0);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: cmd-run-shell.c,v 1.92 2026/07/14 17:17:17 nicm Exp $ */
|
||||
/* $OpenBSD: cmd-run-shell.c,v 1.93 2026/07/17 12:42:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
|
||||
@@ -90,8 +90,8 @@ cmd_run_shell_print(struct job *job, const char *msg)
|
||||
cmdq_print(cdata->item, "%s", msg);
|
||||
return;
|
||||
}
|
||||
if (cdata->item != NULL && cdata->client != NULL)
|
||||
wp = server_client_get_pane(cdata->client);
|
||||
if (cdata->client != NULL && cdata->client->session != NULL)
|
||||
wp = cdata->client->session->curw->window->active;
|
||||
if (wp == NULL && cmd_find_from_nothing(&fs, 0) == 0)
|
||||
wp = fs.wp;
|
||||
if (wp == NULL)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: cmd-select-pane.c,v 1.76 2026/07/10 13:38:45 nicm Exp $ */
|
||||
/* $OpenBSD: cmd-select-pane.c,v 1.77 2026/07/17 12:42:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@@ -150,13 +150,12 @@ cmd_select_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||
const struct cmd_entry *entry = cmd_get_entry(self);
|
||||
struct cmd_find_state *current = cmdq_get_current(item);
|
||||
struct cmd_find_state *target = cmdq_get_target(item);
|
||||
struct client *c = cmdq_get_client(item);
|
||||
struct event_payload *ep;
|
||||
struct cmd_find_state fs;
|
||||
struct winlink *wl = target->wl;
|
||||
struct window *w = wl->window;
|
||||
struct session *s = target->s;
|
||||
struct window_pane *wp = target->wp, *activewp, *lastwp;
|
||||
struct window_pane *wp = target->wp, *lastwp;
|
||||
struct options *oo = wp->options;
|
||||
char *title;
|
||||
const char *style;
|
||||
@@ -267,18 +266,12 @@ cmd_select_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||
return (CMD_RETURN_NORMAL);
|
||||
}
|
||||
|
||||
if (c != NULL && c->session != NULL && (c->flags & CLIENT_ACTIVEPANE))
|
||||
activewp = server_client_get_pane(c);
|
||||
else
|
||||
activewp = w->active;
|
||||
if (wp == activewp)
|
||||
if (wp == w->active)
|
||||
return (CMD_RETURN_NORMAL);
|
||||
if (window_push_zoom(w, 0, args_has(args, 'Z')))
|
||||
server_redraw_window(w);
|
||||
window_redraw_active_switch(w, wp);
|
||||
if (c != NULL && c->session != NULL && (c->flags & CLIENT_ACTIVEPANE))
|
||||
server_client_set_pane(c, wp);
|
||||
else if (window_set_active_pane(w, wp, 1))
|
||||
if (window_set_active_pane(w, wp, 1))
|
||||
cmd_find_from_winlink_pane(current, wl, wp, 0);
|
||||
cmdq_insert_hook(s, item, current, "after-select-pane");
|
||||
cmd_select_pane_redraw(w);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: screen-redraw.c,v 1.152 2026/07/16 10:52:32 nicm Exp $ */
|
||||
/* $OpenBSD: screen-redraw.c,v 1.153 2026/07/17 12:42:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2026 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@@ -1599,7 +1599,7 @@ redraw_set_draw_context(struct redraw_draw_ctx *dctx,
|
||||
|
||||
if (server_is_marked(s, s->curw, marked_pane.wp))
|
||||
dctx->marked = marked_pane.wp;
|
||||
dctx->active = server_client_get_pane(c);
|
||||
dctx->active = s->curw->window->active;
|
||||
|
||||
lines = status_line_size(c);
|
||||
if (options_get_number(oo, "status-position") == 0)
|
||||
|
||||
132
server-client.c
132
server-client.c
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: server-client.c,v 1.496 2026/07/17 08:37:29 nicm Exp $ */
|
||||
/* $OpenBSD: server-client.c,v 1.497 2026/07/17 12:42:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@@ -44,47 +44,12 @@ static void server_client_set_path(struct client *);
|
||||
static void server_client_set_progress_bar(struct client *);
|
||||
static void server_client_reset_state(struct client *);
|
||||
static void server_client_update_latest(struct client *);
|
||||
static void server_client_remove_active_pane_client(struct client *);
|
||||
static void server_client_dispatch(struct imsg *, void *);
|
||||
static int server_client_dispatch_command(struct client *, struct imsg *);
|
||||
static int server_client_dispatch_identify(struct client *, struct imsg *);
|
||||
static int server_client_dispatch_shell(struct client *);
|
||||
static void server_client_report_theme(struct client *, enum client_theme);
|
||||
|
||||
/* Client active pane. */
|
||||
struct client_active_pane {
|
||||
struct client *client;
|
||||
u_int window;
|
||||
struct window_pane *pane;
|
||||
|
||||
RB_ENTRY(client_active_pane) entry;
|
||||
};
|
||||
RB_HEAD(client_active_panes, client_active_pane);
|
||||
|
||||
/* Compare client active panes. */
|
||||
static int
|
||||
server_client_active_pane_cmp(struct client_active_pane *cap1,
|
||||
struct client_active_pane *cap2)
|
||||
{
|
||||
uintptr_t c1 = (uintptr_t)cap1->client;
|
||||
uintptr_t c2 = (uintptr_t)cap2->client;
|
||||
|
||||
if (c1 < c2)
|
||||
return (-1);
|
||||
if (c1 > c2)
|
||||
return (1);
|
||||
if (cap1->window < cap2->window)
|
||||
return (-1);
|
||||
if (cap1->window > cap2->window)
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
||||
RB_GENERATE_STATIC(client_active_panes, client_active_pane, entry,
|
||||
server_client_active_pane_cmp);
|
||||
|
||||
static struct client_active_panes client_active_panes =
|
||||
RB_INITIALIZER(&client_active_panes);
|
||||
|
||||
/* Number of attached clients. */
|
||||
u_int
|
||||
server_client_how_many(void)
|
||||
@@ -525,7 +490,6 @@ server_client_lost(struct client *c)
|
||||
server_client_clear_overlay(c);
|
||||
status_prompt_clear(c);
|
||||
status_message_clear(c);
|
||||
server_client_remove_active_pane_client(c);
|
||||
|
||||
RB_FOREACH_SAFE(cf, client_files, &c->files, cf1) {
|
||||
cf->error = EINTR;
|
||||
@@ -2137,7 +2101,7 @@ server_client_reset_state(struct client *c)
|
||||
{
|
||||
struct tty *tty = &c->tty;
|
||||
struct window *w = c->session->curw->window;
|
||||
struct window_pane *wp = server_client_get_pane(c), *loop;
|
||||
struct window_pane *wp = w->active, *loop;
|
||||
struct screen *s = NULL;
|
||||
struct options *oo = c->session->options;
|
||||
int mode = 0, cursor, flags, pane_mode = 0;
|
||||
@@ -3040,8 +3004,6 @@ server_client_set_flags(struct client *c, const char *flags)
|
||||
flag = CLIENT_READONLY;
|
||||
else if (strcmp(next, "ignore-size") == 0)
|
||||
flag = CLIENT_IGNORESIZE;
|
||||
else if (strcmp(next, "active-pane") == 0)
|
||||
flag = CLIENT_ACTIVEPANE;
|
||||
else if (strcmp(next, "no-detach-on-destroy") == 0)
|
||||
flag = CLIENT_NO_DETACH_ON_DESTROY;
|
||||
if (flag == 0)
|
||||
@@ -3090,8 +3052,6 @@ server_client_get_flags(struct client *c)
|
||||
}
|
||||
if (c->flags & CLIENT_READONLY)
|
||||
strlcat(s, "read-only,", sizeof s);
|
||||
if (c->flags & CLIENT_ACTIVEPANE)
|
||||
strlcat(s, "active-pane,", sizeof s);
|
||||
if (c->flags & CLIENT_SUSPENDED)
|
||||
strlcat(s, "suspended,", sizeof s);
|
||||
if (c->flags & CLIENT_UTF8)
|
||||
@@ -3101,97 +3061,11 @@ server_client_get_flags(struct client *c)
|
||||
return (s);
|
||||
}
|
||||
|
||||
/* Get client active pane. */
|
||||
static struct client_active_pane *
|
||||
server_client_get_active_pane(struct client *c, u_int id)
|
||||
{
|
||||
struct client_active_pane cap = { .client = c, .window = id };
|
||||
|
||||
return (RB_FIND(client_active_panes, &client_active_panes, &cap));
|
||||
}
|
||||
|
||||
/* Add client active pane. */
|
||||
static struct client_active_pane *
|
||||
server_client_add_active_pane(struct client *c, u_int id)
|
||||
{
|
||||
struct client_active_pane *cap;
|
||||
|
||||
cap = server_client_get_active_pane(c, id);
|
||||
if (cap == NULL) {
|
||||
cap = xcalloc(1, sizeof *cap);
|
||||
cap->client = c;
|
||||
cap->window = id;
|
||||
RB_INSERT(client_active_panes, &client_active_panes, cap);
|
||||
}
|
||||
return (cap);
|
||||
}
|
||||
|
||||
/* Get client active pane. */
|
||||
struct window_pane *
|
||||
server_client_get_pane(struct client *c)
|
||||
{
|
||||
struct session *s = c->session;
|
||||
struct window *w;
|
||||
struct client_active_pane *cap;
|
||||
|
||||
if (s == NULL)
|
||||
return (NULL);
|
||||
|
||||
w = s->curw->window;
|
||||
if (w->modal != NULL)
|
||||
return (w->modal);
|
||||
if (~c->flags & CLIENT_ACTIVEPANE)
|
||||
return (w->active);
|
||||
cap = server_client_get_active_pane(c, w->id);
|
||||
if (cap == NULL)
|
||||
return (w->active);
|
||||
return (cap->pane);
|
||||
}
|
||||
|
||||
/* Set client active pane. */
|
||||
void
|
||||
server_client_set_pane(struct client *c, struct window_pane *wp)
|
||||
{
|
||||
struct session *s = c->session;
|
||||
struct client_active_pane *cap;
|
||||
|
||||
if (s == NULL)
|
||||
return;
|
||||
if (wp->window->modal != NULL && wp != wp->window->modal)
|
||||
return;
|
||||
|
||||
cap = server_client_add_active_pane(c, s->curw->window->id);
|
||||
cap->pane = wp;
|
||||
log_debug("%s pane now %%%u", c->name, wp->id);
|
||||
}
|
||||
|
||||
/* Remove active pane entries for a client. */
|
||||
static void
|
||||
server_client_remove_active_pane_client(struct client *c)
|
||||
{
|
||||
struct client_active_pane *cap, *cap1;
|
||||
|
||||
RB_FOREACH_SAFE(cap, client_active_panes, &client_active_panes, cap1) {
|
||||
if (cap->client == c) {
|
||||
RB_REMOVE(client_active_panes, &client_active_panes, cap);
|
||||
free(cap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Remove pane from client state. */
|
||||
void
|
||||
server_client_remove_pane(struct window_pane *wp)
|
||||
{
|
||||
struct client *c;
|
||||
struct client_active_pane *cap, *cap1;
|
||||
|
||||
RB_FOREACH_SAFE(cap, client_active_panes, &client_active_panes, cap1) {
|
||||
if (cap->pane == wp) {
|
||||
RB_REMOVE(client_active_panes, &client_active_panes, cap);
|
||||
free(cap);
|
||||
}
|
||||
}
|
||||
|
||||
TAILQ_FOREACH(c, &clients, entry) {
|
||||
if (c->tty.mouse_last_pane == (int)wp->id) {
|
||||
@@ -3246,7 +3120,7 @@ server_client_print(struct client *c, int parse, struct evbuffer *evb)
|
||||
goto out;
|
||||
}
|
||||
|
||||
wp = server_client_get_pane(c);
|
||||
wp = c->session->curw->window->active;
|
||||
wme = TAILQ_FIRST(&wp->modes);
|
||||
if (wme == NULL || wme->mode != &window_view_mode)
|
||||
window_pane_set_mode(wp, NULL, &window_view_mode, NULL, NULL,
|
||||
|
||||
13
tmux.1
13
tmux.1
@@ -1,4 +1,4 @@
|
||||
.\" $OpenBSD: tmux.1,v 1.1142 2026/07/15 13:02:33 nicm Exp $
|
||||
.\" $OpenBSD: tmux.1,v 1.1143 2026/07/17 12:42:51 nicm Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
.\"
|
||||
@@ -14,7 +14,7 @@
|
||||
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.Dd $Mdocdate: July 15 2026 $
|
||||
.Dd $Mdocdate: July 17 2026 $
|
||||
.Dt TMUX 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@@ -1112,8 +1112,6 @@ detaching the client, typically causing it to exit.
|
||||
sets a comma-separated list of client flags.
|
||||
The flags are:
|
||||
.Bl -tag -width Ds
|
||||
.It active\-pane
|
||||
the client has an independent active pane
|
||||
.It ignore\-size
|
||||
the client does not affect the size of other clients
|
||||
.It no\-detach\-on\-destroy
|
||||
@@ -1143,13 +1141,6 @@ When a client is read-only, only keys bound to the
|
||||
or
|
||||
.Ic switch\-client
|
||||
commands have any effect.
|
||||
A client with the
|
||||
.Ar active\-pane
|
||||
flag allows the active pane to be selected independently of the window's active
|
||||
pane used by clients without the flag.
|
||||
This only affects the cursor position and commands issued from the client;
|
||||
other features such as hooks and styles continue to use the window's active
|
||||
pane.
|
||||
.Pp
|
||||
If no server is started,
|
||||
.Ic attach\-session
|
||||
|
||||
6
tmux.h
6
tmux.h
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: tmux.h,v 1.1407 2026/07/17 08:37:29 nicm Exp $ */
|
||||
/* $OpenBSD: tmux.h,v 1.1408 2026/07/17 12:42:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@@ -2257,7 +2257,7 @@ struct client {
|
||||
#define CLIENT_STARTSERVER 0x10000000
|
||||
#define CLIENT_REDRAWMENU 0x20000000
|
||||
#define CLIENT_NOFORK 0x40000000
|
||||
#define CLIENT_ACTIVEPANE 0x80000000ULL
|
||||
/* 0x80000000ULL unused */
|
||||
#define CLIENT_CONTROL_PAUSEAFTER 0x100000000ULL
|
||||
#define CLIENT_CONTROL_WAITEXIT 0x200000000ULL
|
||||
#define CLIENT_WINDOWSIZECHANGED 0x400000000ULL
|
||||
@@ -3295,8 +3295,6 @@ void server_client_loop(void);
|
||||
const char *server_client_get_cwd(struct client *, struct session *);
|
||||
void server_client_set_flags(struct client *, const char *);
|
||||
const char *server_client_get_flags(struct client *);
|
||||
struct window_pane *server_client_get_pane(struct client *);
|
||||
void server_client_set_pane(struct client *, struct window_pane *);
|
||||
void server_client_remove_pane(struct window_pane *);
|
||||
void server_client_print(struct client *, int, struct evbuffer *);
|
||||
|
||||
|
||||
4
tty.c
4
tty.c
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: tty.c,v 1.476 2026/06/26 11:36:22 nicm Exp $ */
|
||||
/* $OpenBSD: tty.c,v 1.477 2026/07/17 12:42:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@@ -960,7 +960,7 @@ tty_window_offset1(struct tty *tty, u_int *ox, u_int *oy, u_int *sx, u_int *sy)
|
||||
{
|
||||
struct client *c = tty->client;
|
||||
struct window *w = c->session->curw->window;
|
||||
struct window_pane *wp = server_client_get_pane(c);
|
||||
struct window_pane *wp = w->active;
|
||||
u_int cx, cy, lines;
|
||||
|
||||
lines = status_line_size(c);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: window-border.c,v 1.1 2026/06/22 08:47:46 nicm Exp $ */
|
||||
/* $OpenBSD: window-border.c,v 1.2 2026/07/17 12:42:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2026 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@@ -93,7 +93,7 @@ window_pane_get_border_style(struct window_pane *wp, struct client *c,
|
||||
struct grid_cell *saved;
|
||||
int *flag;
|
||||
|
||||
if (wp == server_client_get_pane(c)) {
|
||||
if (wp == c->session->curw->window->active) {
|
||||
flag = &wp->active_border_gc_set;
|
||||
saved = &wp->active_border_gc;
|
||||
option = "pane-active-border-style";
|
||||
|
||||
Reference in New Issue
Block a user