1
0
mirror of https://github.com/tmate-io/tmate-ssh-server.git synced 2020-11-18 19:53:51 -08:00

Synchronize the list binding pane (bind-key + ?)

This commit is contained in:
Nicolas Viennot 2013-06-26 02:05:13 -04:00
parent 59cab76dd8
commit c9a6e2560a
5 changed files with 33 additions and 1 deletions

View File

@ -49,6 +49,16 @@ cmd_list_keys_exec(struct cmd *self, struct cmd_q *cmdq)
size_t used;
int width, keywidth;
#ifdef TMATE
/* XXX TODO Really nasty hack, we really need our own client instance... */
struct client fake_client;
if (!cmdq->client) {
cmdq->client = &fake_client;
cmdq->client->flags = 0;
cmdq->client->session = RB_MIN(sessions, &sessions);
}
#endif
if (args_has(args, 't'))
return (cmd_list_keys_table(self, cmdq));

View File

@ -82,6 +82,7 @@ cmdq_print(struct cmd_q *cmdq, const char *fmt, ...)
window_pane_reset_mode(w->active);
window_pane_set_mode(w->active, &window_copy_mode);
window_copy_init_for_output(w->active);
tmate_sync_copy_mode(w->active);
}
window_copy_vadd(w->active, fmt, ap);
}

View File

@ -194,7 +194,8 @@ void tmate_sync_copy_mode(struct window_pane *wp)
pack(array, 0);
return;
}
pack(array, 5);
pack(array, 6);
pack(int, data->backing == &wp->base);
pack(int, data->oy);
pack(int, data->cx);
@ -217,3 +218,11 @@ void tmate_sync_copy_mode(struct window_pane *wp)
} else
pack(array, 0);
}
void tmate_write_copy_mode(struct window_pane *wp, const char *str)
{
pack(array, 3);
pack(int, TMATE_WRITE_COPY_MODE);
pack(int, wp->id);
pack(string, str);
}

View File

@ -27,6 +27,7 @@ enum tmate_commands {
TMATE_FAILED_CMD,
TMATE_STATUS,
TMATE_SYNC_COPY_MODE,
TMATE_WRITE_COPY_MODE,
};
struct tmate_encoder {
@ -45,6 +46,7 @@ extern void tmate_exec_cmd(const char *cmd);
extern void tmate_failed_cmd(int client_id, const char *cause);
extern void tmate_status(const char *left, const char *right);
extern void tmate_sync_copy_mode(struct window_pane *wp);
extern void tmate_write_copy_mode(struct window_pane *wp, const char *str);
/* tmate-decoder.c */

View File

@ -216,6 +216,9 @@ window_copy_vadd(struct window_pane *wp, const char *fmt, va_list ap)
struct grid_cell gc;
int utf8flag;
u_int old_hsize;
#ifdef TMATE
char *msg;
#endif
if (backing == &wp->base)
return;
@ -234,7 +237,14 @@ window_copy_vadd(struct window_pane *wp, const char *fmt, va_list ap)
screen_write_linefeed(&back_ctx, 0);
} else
data->backing_written = 1;
#ifdef TMATE
xvasprintf(&msg, fmt, ap);
screen_write_nputs(&back_ctx, 0, &gc, utf8flag, "%s", msg);
tmate_write_copy_mode(wp, msg);
free(msg);
#else
screen_write_vnputs(&back_ctx, 0, &gc, utf8flag, fmt, ap);
#endif
screen_write_stop(&back_ctx);
data->oy += screen_hsize(data->backing) - old_hsize;