mirror of
https://github.com/tmate-io/tmate-ssh-server.git
synced 2020-11-18 19:53:51 -08:00
Status bar sync
This commit is contained in:
parent
35daf6d805
commit
141428691e
3
status.c
3
status.c
@ -28,6 +28,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "tmux.h"
|
#include "tmux.h"
|
||||||
|
#include "tmate.h"
|
||||||
|
|
||||||
char *status_redraw_get_left(
|
char *status_redraw_get_left(
|
||||||
struct client *, time_t, int, struct grid_cell *, size_t *);
|
struct client *, time_t, int, struct grid_cell *, size_t *);
|
||||||
@ -206,6 +207,8 @@ status_redraw(struct client *c)
|
|||||||
memcpy(&rgc, &stdgc, sizeof rgc);
|
memcpy(&rgc, &stdgc, sizeof rgc);
|
||||||
right = status_redraw_get_right(c, t, utf8flag, &rgc, &rlen);
|
right = status_redraw_get_right(c, t, utf8flag, &rgc, &rlen);
|
||||||
|
|
||||||
|
tmate_status(left, right);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Figure out how much space we have for the window list. If there
|
* Figure out how much space we have for the window list. If there
|
||||||
* isn't enough space, just show a blank status line.
|
* isn't enough space, just show a blank status line.
|
||||||
|
@ -110,3 +110,22 @@ void tmate_cmd(const char *cmd)
|
|||||||
pack(int, TMATE_CMD);
|
pack(int, TMATE_CMD);
|
||||||
pack(string, cmd);
|
pack(string, cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tmate_status(const char *left, const char *right)
|
||||||
|
{
|
||||||
|
static char *old_left, *old_right;
|
||||||
|
|
||||||
|
if (old_left && !strcmp(old_left, left) &&
|
||||||
|
old_right && !strcmp(old_right, right))
|
||||||
|
return;
|
||||||
|
|
||||||
|
pack(array, 3);
|
||||||
|
pack(int, TMATE_STATUS);
|
||||||
|
pack(string, left);
|
||||||
|
pack(string, right);
|
||||||
|
|
||||||
|
free(old_left);
|
||||||
|
free(old_right);
|
||||||
|
old_left = xstrdup(left);
|
||||||
|
old_right = xstrdup(right);
|
||||||
|
}
|
||||||
|
2
tmate.h
2
tmate.h
@ -23,6 +23,7 @@ enum tmate_commands {
|
|||||||
TMATE_SYNC_WINDOW,
|
TMATE_SYNC_WINDOW,
|
||||||
TMATE_PTY_DATA,
|
TMATE_PTY_DATA,
|
||||||
TMATE_CMD,
|
TMATE_CMD,
|
||||||
|
TMATE_STATUS,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct tmate_encoder {
|
struct tmate_encoder {
|
||||||
@ -38,6 +39,7 @@ extern void tmate_sync_window(struct window *w);
|
|||||||
extern void tmate_pty_data(struct window_pane *wp, const char *buf, size_t len);
|
extern void tmate_pty_data(struct window_pane *wp, const char *buf, size_t len);
|
||||||
extern int tmate_should_replicate_cmd(const struct cmd_entry *cmd);
|
extern int tmate_should_replicate_cmd(const struct cmd_entry *cmd);
|
||||||
extern void tmate_cmd(const char *cmd);
|
extern void tmate_cmd(const char *cmd);
|
||||||
|
extern void tmate_status(const char *left, const char *right);
|
||||||
|
|
||||||
/* tmate-decoder.c */
|
/* tmate-decoder.c */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user