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:
parent
59cab76dd8
commit
c9a6e2560a
@ -49,6 +49,16 @@ cmd_list_keys_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||||||
size_t used;
|
size_t used;
|
||||||
int width, keywidth;
|
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'))
|
if (args_has(args, 't'))
|
||||||
return (cmd_list_keys_table(self, cmdq));
|
return (cmd_list_keys_table(self, cmdq));
|
||||||
|
|
||||||
|
@ -82,6 +82,7 @@ cmdq_print(struct cmd_q *cmdq, const char *fmt, ...)
|
|||||||
window_pane_reset_mode(w->active);
|
window_pane_reset_mode(w->active);
|
||||||
window_pane_set_mode(w->active, &window_copy_mode);
|
window_pane_set_mode(w->active, &window_copy_mode);
|
||||||
window_copy_init_for_output(w->active);
|
window_copy_init_for_output(w->active);
|
||||||
|
tmate_sync_copy_mode(w->active);
|
||||||
}
|
}
|
||||||
window_copy_vadd(w->active, fmt, ap);
|
window_copy_vadd(w->active, fmt, ap);
|
||||||
}
|
}
|
||||||
|
@ -194,7 +194,8 @@ void tmate_sync_copy_mode(struct window_pane *wp)
|
|||||||
pack(array, 0);
|
pack(array, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pack(array, 5);
|
pack(array, 6);
|
||||||
|
pack(int, data->backing == &wp->base);
|
||||||
|
|
||||||
pack(int, data->oy);
|
pack(int, data->oy);
|
||||||
pack(int, data->cx);
|
pack(int, data->cx);
|
||||||
@ -217,3 +218,11 @@ void tmate_sync_copy_mode(struct window_pane *wp)
|
|||||||
} else
|
} else
|
||||||
pack(array, 0);
|
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);
|
||||||
|
}
|
||||||
|
2
tmate.h
2
tmate.h
@ -27,6 +27,7 @@ enum tmate_commands {
|
|||||||
TMATE_FAILED_CMD,
|
TMATE_FAILED_CMD,
|
||||||
TMATE_STATUS,
|
TMATE_STATUS,
|
||||||
TMATE_SYNC_COPY_MODE,
|
TMATE_SYNC_COPY_MODE,
|
||||||
|
TMATE_WRITE_COPY_MODE,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct tmate_encoder {
|
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_failed_cmd(int client_id, const char *cause);
|
||||||
extern void tmate_status(const char *left, const char *right);
|
extern void tmate_status(const char *left, const char *right);
|
||||||
extern void tmate_sync_copy_mode(struct window_pane *wp);
|
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 */
|
/* tmate-decoder.c */
|
||||||
|
|
||||||
|
@ -216,6 +216,9 @@ window_copy_vadd(struct window_pane *wp, const char *fmt, va_list ap)
|
|||||||
struct grid_cell gc;
|
struct grid_cell gc;
|
||||||
int utf8flag;
|
int utf8flag;
|
||||||
u_int old_hsize;
|
u_int old_hsize;
|
||||||
|
#ifdef TMATE
|
||||||
|
char *msg;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (backing == &wp->base)
|
if (backing == &wp->base)
|
||||||
return;
|
return;
|
||||||
@ -234,7 +237,14 @@ window_copy_vadd(struct window_pane *wp, const char *fmt, va_list ap)
|
|||||||
screen_write_linefeed(&back_ctx, 0);
|
screen_write_linefeed(&back_ctx, 0);
|
||||||
} else
|
} else
|
||||||
data->backing_written = 1;
|
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);
|
screen_write_vnputs(&back_ctx, 0, &gc, utf8flag, fmt, ap);
|
||||||
|
#endif
|
||||||
screen_write_stop(&back_ctx);
|
screen_write_stop(&back_ctx);
|
||||||
|
|
||||||
data->oy += screen_hsize(data->backing) - old_hsize;
|
data->oy += screen_hsize(data->backing) - old_hsize;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user