mirror of
https://github.com/tmate-io/tmate-ssh-server.git
synced 2020-11-18 19:53:51 -08:00
snapshot param is only for the history size
This commit is contained in:
parent
339464b6cb
commit
ea331cead9
@ -18,7 +18,7 @@ static void ctl_daemon_fwd_msg(struct tmate_session *session,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void do_snapshot(struct tmate_unpacker *uk,
|
static void do_snapshot(struct tmate_unpacker *uk,
|
||||||
unsigned int max_snapshot_lines,
|
unsigned int max_history_lines,
|
||||||
struct window_pane *pane)
|
struct window_pane *pane)
|
||||||
{
|
{
|
||||||
struct screen *screen;
|
struct screen *screen;
|
||||||
@ -27,6 +27,7 @@ static void do_snapshot(struct tmate_unpacker *uk,
|
|||||||
struct grid_cell *cell;
|
struct grid_cell *cell;
|
||||||
struct utf8_data utf8;
|
struct utf8_data utf8;
|
||||||
unsigned int line_i, i;
|
unsigned int line_i, i;
|
||||||
|
unsigned int max_lines;
|
||||||
size_t str_len;
|
size_t str_len;
|
||||||
|
|
||||||
screen = &pane->base;
|
screen = &pane->base;
|
||||||
@ -39,15 +40,15 @@ static void do_snapshot(struct tmate_unpacker *uk,
|
|||||||
pack(int, screen->cx);
|
pack(int, screen->cx);
|
||||||
pack(int, screen->cy);
|
pack(int, screen->cy);
|
||||||
|
|
||||||
|
max_lines = max_history_lines + grid->sy;
|
||||||
|
|
||||||
#define grid_num_lines(grid) (grid->hsize + grid->sy)
|
#define grid_num_lines(grid) (grid->hsize + grid->sy)
|
||||||
|
|
||||||
if (grid_num_lines(grid) > max_snapshot_lines)
|
if (grid_num_lines(grid) > max_lines)
|
||||||
line_i = grid_num_lines(grid) - max_snapshot_lines;
|
line_i = grid_num_lines(grid) - max_lines;
|
||||||
else
|
else
|
||||||
line_i = 0;
|
line_i = 0;
|
||||||
|
|
||||||
line_i = 0;
|
|
||||||
|
|
||||||
pack(array, grid_num_lines(grid) - line_i);
|
pack(array, grid_num_lines(grid) - line_i);
|
||||||
for (; line_i < grid_num_lines(grid); line_i++) {
|
for (; line_i < grid_num_lines(grid); line_i++) {
|
||||||
line = &grid->linedata[line_i];
|
line = &grid->linedata[line_i];
|
||||||
@ -85,10 +86,10 @@ static void ctl_daemon_request_snapshot(struct tmate_session *session,
|
|||||||
struct winlink *wl;
|
struct winlink *wl;
|
||||||
struct window *w;
|
struct window *w;
|
||||||
struct window_pane *pane;
|
struct window_pane *pane;
|
||||||
int max_snapshot_lines;
|
int max_history_lines;
|
||||||
int num_panes;
|
int num_panes;
|
||||||
|
|
||||||
max_snapshot_lines = unpack_int(uk);
|
max_history_lines = unpack_int(uk);
|
||||||
|
|
||||||
pack(array, 2);
|
pack(array, 2);
|
||||||
pack(int, TMATE_CTL_SNAPSHOT);
|
pack(int, TMATE_CTL_SNAPSHOT);
|
||||||
@ -114,7 +115,7 @@ static void ctl_daemon_request_snapshot(struct tmate_session *session,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
TAILQ_FOREACH(pane, &w->panes, entry)
|
TAILQ_FOREACH(pane, &w->panes, entry)
|
||||||
do_snapshot(uk, max_snapshot_lines, pane);
|
do_snapshot(uk, max_history_lines, pane);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user