-/* $OpenBSD: cmd-attach-session.c,v 1.71 2017/04/21 14:01:19 nicm Exp $ */
+/* $OpenBSD: cmd-attach-session.c,v 1.72 2017/04/22 08:56:24 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
cmd_attach_session(struct cmdq_item *item, int dflag, int rflag,
const char *cflag, int Eflag)
{
+ struct cmd_find_state *current = &item->shared->current;
struct session *s = item->state.tflag.s;
struct client *c = item->client, *c_loop;
struct winlink *wl = item->state.tflag.wl;
if (wp != NULL)
window_set_active_pane(wp->window, wp);
session_set_current(s, wl);
+ if (wp != NULL)
+ cmd_find_from_winlink_pane(current, wl, wp);
+ else
+ cmd_find_from_winlink(current, wl);
}
if (cflag != NULL) {
-/* $OpenBSD: cmd-break-pane.c,v 1.43 2017/03/08 13:36:12 nicm Exp $ */
+/* $OpenBSD: cmd-break-pane.c,v 1.44 2017/04/22 08:56:24 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
cmd_break_pane_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
+ struct cmd_find_state *current = &item->shared->current;
struct client *c = item->state.c;
struct winlink *wl = item->state.sflag.wl;
struct session *src_s = item->state.sflag.s;
if (idx == -1)
idx = -1 - options_get_number(dst_s->options, "base-index");
wl = session_attach(dst_s, w, idx, &cause); /* can't fail */
- if (!args_has(self->args, 'd'))
+ if (!args_has(self->args, 'd')) {
session_select(dst_s, wl->idx);
+ cmd_find_from_session(current, dst_s);
+ }
server_redraw_session(src_s);
if (src_s != dst_s)
-/* $OpenBSD: cmd-find-window.c,v 1.39 2016/10/16 19:04:05 nicm Exp $ */
+/* $OpenBSD: cmd-find-window.c,v 1.40 2017/04/22 08:56:24 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
cmd_find_window_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
+ struct cmd_find_state *current = &item->shared->current;
struct client *c = item->state.c;
struct window_choose_data *cdata;
struct session *s = item->state.tflag.s;
}
if (TAILQ_NEXT(TAILQ_FIRST(&find_list), entry) == NULL) {
- if (session_select(s, TAILQ_FIRST(&find_list)->wl->idx) == 0)
+ if (session_select(s, TAILQ_FIRST(&find_list)->wl->idx) == 0) {
+ cmd_find_from_session(current, s);
server_redraw_session(s);
+ }
recalculate_sizes();
goto out;
}
-/* $OpenBSD: cmd-join-pane.c,v 1.30 2016/10/16 22:06:40 nicm Exp $ */
+/* $OpenBSD: cmd-join-pane.c,v 1.31 2017/04/22 08:56:24 nicm Exp $ */
/*
* Copyright (c) 2011 George Nachman <tmux@georgester.com>
cmd_join_pane_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
+ struct cmd_find_state *current = &item->shared->current;
struct session *dst_s;
struct winlink *src_wl, *dst_wl;
struct window *src_w, *dst_w;
if (!args_has(args, 'd')) {
window_set_active_pane(dst_w, src_wp);
session_select(dst_s, dst_idx);
+ cmd_find_from_session(current, dst_s);
server_redraw_session(dst_s);
} else
server_status_session(dst_s);
-/* $OpenBSD: cmd-new-session.c,v 1.103 2017/04/21 14:01:19 nicm Exp $ */
+/* $OpenBSD: cmd-new-session.c,v 1.104 2017/04/22 08:56:24 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
free(cp);
}
- if (!detached)
+ if (!detached) {
c->flags |= CLIENT_ATTACHED;
+ cmd_find_from_session(&item->shared->current, s);
+ }
if (to_free != NULL)
free((void *)to_free);
-/* $OpenBSD: cmd-new-window.c,v 1.68 2017/04/21 14:09:44 nicm Exp $ */
+/* $OpenBSD: cmd-new-window.c,v 1.69 2017/04/22 08:56:24 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
cmd_new_window_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
+ struct cmd_find_state *current = &item->shared->current;
struct session *s = item->state.tflag.s;
struct winlink *wl = item->state.tflag.wl;
struct client *c = item->state.c;
}
if (!detached) {
session_select(s, wl->idx);
+ cmd_find_from_winlink(current, wl);
server_redraw_session_group(s);
} else
server_status_session_group(s);
-/* $OpenBSD: cmd-select-pane.c,v 1.36 2017/04/21 21:02:26 nicm Exp $ */
+/* $OpenBSD: cmd-select-pane.c,v 1.37 2017/04/22 08:56:24 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
cmd_select_pane_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
+ struct cmd_find_state *current = &item->shared->current;
struct winlink *wl = item->state.tflag.wl;
struct window *w = wl->window;
struct session *s = item->state.tflag.s;
cmdq_error(item, "no last pane");
return (CMD_RETURN_ERROR);
}
-
if (args_has(self->args, 'e'))
lastwp->flags &= ~PANE_INPUTOFF;
else if (args_has(self->args, 'd'))
server_unzoom_window(w);
window_redraw_active_switch(w, lastwp);
if (window_set_active_pane(w, lastwp)) {
+ cmd_find_from_winlink(current, wl);
server_status_window(w);
server_redraw_window_borders(w);
}
}
window_redraw_active_switch(w, wp);
if (window_set_active_pane(w, wp)) {
+ cmd_find_from_winlink(current, wl);
server_status_window(w);
server_redraw_window_borders(w);
}
-/* $OpenBSD: cmd-select-window.c,v 1.18 2016/10/16 19:04:05 nicm Exp $ */
+/* $OpenBSD: cmd-select-window.c,v 1.19 2017/04/22 08:56:24 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
static enum cmd_retval
cmd_select_window_exec(struct cmd *self, struct cmdq_item *item)
{
- struct winlink *wl = item->state.tflag.wl;
- struct session *s = item->state.tflag.s;
- int next, previous, last, activity;
+ struct cmd_find_state *current = &item->shared->current;
+ struct winlink *wl = item->state.tflag.wl;
+ struct session *s = item->state.tflag.s;
+ int next, previous, last, activity;
next = self->entry == &cmd_next_window_entry;
if (args_has(self->args, 'n'))
return (CMD_RETURN_ERROR);
}
}
-
+ cmd_find_from_session(&item->shared->current, s);
server_redraw_session(s);
} else {
/*
cmdq_error(item, "no last window");
return (-1);
}
+ if (current->s == s)
+ cmd_find_from_session(current, s);
server_redraw_session(s);
- } else if (session_select(s, wl->idx) == 0)
+ } else if (session_select(s, wl->idx) == 0) {
+ cmd_find_from_session(current, s);
server_redraw_session(s);
+ }
}
recalculate_sizes();
-/* $OpenBSD: cmd-split-window.c,v 1.81 2017/04/21 17:22:20 nicm Exp $ */
+/* $OpenBSD: cmd-split-window.c,v 1.82 2017/04/22 08:56:24 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
static enum cmd_retval
cmd_split_window_exec(struct cmd *self, struct cmdq_item *item)
{
+ struct cmd_find_state *current = &item->shared->current;
struct args *args = self->args;
struct client *c = item->state.c;
struct session *s = item->state.tflag.s;
if (!args_has(args, 'd')) {
window_set_active_pane(w, new_wp);
session_select(s, wl->idx);
+ cmd_find_from_session(current, s);
server_redraw_session(s);
} else
server_status_session(s);
-/* $OpenBSD: cmd-switch-client.c,v 1.49 2017/04/21 14:01:19 nicm Exp $ */
+/* $OpenBSD: cmd-switch-client.c,v 1.50 2017/04/22 08:56:24 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
if (wp != NULL)
window_set_active_pane(wp->window, wp);
session_set_current(s, state->tflag.wl);
+ cmd_find_from_session(&item->shared->current, s);
}
}
-/* $OpenBSD: server-client.c,v 1.226 2017/04/21 22:23:24 nicm Exp $ */
+/* $OpenBSD: server-client.c,v 1.227 2017/04/22 08:56:24 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
m->valid = 0;
/* Find affected pane. */
- if (KEYC_IS_MOUSE(key) && m->valid)
- wp = cmd_mouse_pane(m, NULL, NULL);
- else
- wp = w->active;
+ if (!KEYC_IS_MOUSE(key) || cmd_find_from_mouse(&fs, m) != 0)
+ cmd_find_from_session(&fs, s);
+ wp = fs.wp;
/* Forward mouse keys if disabled. */
if (KEYC_IS_MOUSE(key) && !options_get_number(s->options, "mouse"))
}
server_status_client(c);
- /* Find default state if the pane is known. */
- if (KEYC_IS_MOUSE(key) && m->valid && wp != NULL) {
- cmd_find_from_winlink_pane(&fs, s->curw, wp);
- cmd_find_log_state(__func__, &fs);
- key_bindings_dispatch(bd, c, m, &fs);
- } else
- key_bindings_dispatch(bd, c, m, NULL);
+ /* Execute the key binding. */
+ key_bindings_dispatch(bd, c, m, &fs);
key_bindings_unref_table(table);
return;
}