summaryrefslogtreecommitdiffstats
path: root/server-client.c
diff options
context:
space:
mode:
authornicm <nicm>2019-03-12 11:16:49 +0000
committernicm <nicm>2019-03-12 11:16:49 +0000
commit3f6bfbaf2babcc7f08f628a82ff31b0b52014e58 (patch)
treece4bf0c954cdfede0c2e86905bd85a9f565ed370 /server-client.c
parentff4c80d53df96bb46eaa64107673e42d402f0d49 (diff)
Allow multiple modes to be open in a pane. A stack of open modes is kept
and the previous restored when the top is exited. If a mode that is already on the stack is entered, the existing instance is moved to the top as the active mode rather than being opened new.
Diffstat (limited to 'server-client.c')
-rw-r--r--server-client.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/server-client.c b/server-client.c
index a311376c..b7d052a0 100644
--- a/server-client.c
+++ b/server-client.c
@@ -921,18 +921,18 @@ server_client_assume_paste(struct session *s)
void
server_client_handle_key(struct client *c, key_code key)
{
- struct mouse_event *m = &c->tty.mouse;
- struct session *s = c->session;
- struct winlink *wl;
- struct window *w;
- struct window_pane *wp;
- struct timeval tv;
- struct key_table *table, *first;
- const char *tablename;
- struct key_binding *bd;
- int xtimeout, flags;
- struct cmd_find_state fs;
- key_code key0;
+ struct mouse_event *m = &c->tty.mouse;
+ struct session *s = c->session;
+ struct winlink *wl;
+ struct window *w;
+ struct window_pane *wp;
+ struct window_mode_entry *wme;
+ struct timeval tv;
+ struct key_table *table, *first;
+ struct key_binding *bd;
+ int xtimeout, flags;
+ struct cmd_find_state fs;
+ key_code key0;
/* Check the client is good to accept input. */
if (s == NULL || (c->flags & (CLIENT_DEAD|CLIENT_SUSPENDED)) != 0)
@@ -1009,11 +1009,9 @@ server_client_handle_key(struct client *c, key_code key)
*/
if (server_client_is_default_key_table(c, c->keytable) &&
wp != NULL &&
- wp->mode != NULL &&
- wp->mode->mode->key_table != NULL) {
- tablename = wp->mode->mode->key_table(wp->mode);
- table = key_bindings_get_table(tablename, 1);
- }
+ (wme = TAILQ_FIRST(&wp->modes)) != NULL &&
+ wme->mode->key_table != NULL)
+ table = key_bindings_get_table(wme->mode->key_table(wme), 1);
else
table = c->keytable;
first = table;