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.
This commit is contained in:
nicm
2019-03-12 11:16:49 +00:00
parent ff4c80d53d
commit 3f6bfbaf2b
15 changed files with 182 additions and 116 deletions

View File

@ -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;