Merge branch 'obsd-master' into master

This commit is contained in:
Thomas Adam 2020-12-03 08:01:22 +00:00
commit e288ea153c
7 changed files with 64 additions and 3 deletions

View File

@ -40,6 +40,7 @@ static void server_client_repeat_timer(int, short, void *);
static void server_client_click_timer(int, short, void *);
static void server_client_check_exit(struct client *);
static void server_client_check_redraw(struct client *);
static void server_client_check_modes(struct client *);
static void server_client_set_title(struct client *);
static void server_client_reset_state(struct client *);
static int server_client_assume_paste(struct session *);
@ -1353,6 +1354,7 @@ server_client_loop(void)
TAILQ_FOREACH(c, &clients, entry) {
server_client_check_exit(c);
if (c->session != NULL) {
server_client_check_modes(c);
server_client_check_redraw(c);
server_client_reset_state(c);
}
@ -1808,6 +1810,28 @@ server_client_redraw_timer(__unused int fd, __unused short events,
log_debug("redraw timer fired");
}
/*
* Check if modes need to be updated. Only modes in the current window are
* updated and it is done when the status line is redrawn.
*/
static void
server_client_check_modes(struct client *c)
{
struct window *w = c->session->curw->window;
struct window_pane *wp;
struct window_mode_entry *wme;
if (c->flags & (CLIENT_CONTROL|CLIENT_SUSPENDED))
return;
if (~c->flags & CLIENT_REDRAWSTATUS)
return;
TAILQ_FOREACH(wp, &w->panes, entry) {
wme = TAILQ_FIRST(&wp->modes);
if (wme != NULL && wme->mode->update != NULL)
wme->mode->update(wme);
}
}
/* Check for client redraws. */
static void
server_client_check_redraw(struct client *c)

2
tmux.1
View File

@ -4643,7 +4643,7 @@ special characters or with an
suffix, escape hash characters (so
.Ql #
becomes
.Ql ## ).
.Ql ## ) .
.Ql E:\&
will expand the format twice, for example
.Ql #{E:status-left}

1
tmux.h
View File

@ -889,6 +889,7 @@ struct window_mode {
struct cmd_find_state *, struct args *);
void (*free)(struct window_mode_entry *);
void (*resize)(struct window_mode_entry *, u_int, u_int);
void (*update)(struct window_mode_entry *);
void (*key)(struct window_mode_entry *, struct client *,
struct session *, struct winlink *, key_code,
struct mouse_event *);

4
tty.c
View File

@ -2447,7 +2447,7 @@ tty_check_fg(struct tty *tty, int *palette, struct grid_cell *gc)
/* Is this a 256-colour colour? */
if (gc->fg & COLOUR_FLAG_256) {
/* And not a 256 colour mode? */
if (colours != 256) {
if (colours < 256) {
gc->fg = colour_256to16(gc->fg);
if (gc->fg & 8) {
gc->fg &= 7;
@ -2500,7 +2500,7 @@ tty_check_bg(struct tty *tty, int *palette, struct grid_cell *gc)
* palette. Bold background doesn't exist portably, so just
* discard the bold bit if set.
*/
if (colours != 256) {
if (colours < 256) {
gc->bg = colour_256to16(gc->bg);
if (gc->bg & 8) {
gc->bg &= 7;

View File

@ -31,6 +31,7 @@ static struct screen *window_buffer_init(struct window_mode_entry *,
static void window_buffer_free(struct window_mode_entry *);
static void window_buffer_resize(struct window_mode_entry *, u_int,
u_int);
static void window_buffer_update(struct window_mode_entry *);
static void window_buffer_key(struct window_mode_entry *,
struct client *, struct session *,
struct winlink *, key_code, struct mouse_event *);
@ -63,6 +64,7 @@ const struct window_mode window_buffer_mode = {
.init = window_buffer_init,
.free = window_buffer_free,
.resize = window_buffer_resize,
.update = window_buffer_update,
.key = window_buffer_key,
};
@ -335,6 +337,16 @@ window_buffer_resize(struct window_mode_entry *wme, u_int sx, u_int sy)
mode_tree_resize(data->data, sx, sy);
}
static void
window_buffer_update(struct window_mode_entry *wme)
{
struct window_buffer_modedata *data = wme->data;
mode_tree_build(data->data);
mode_tree_draw(data->data);
data->wp->flags |= PANE_REDRAW;
}
static void
window_buffer_do_delete(void *modedata, void *itemdata,
__unused struct client *c, __unused key_code key)

View File

@ -30,6 +30,7 @@ static struct screen *window_client_init(struct window_mode_entry *,
static void window_client_free(struct window_mode_entry *);
static void window_client_resize(struct window_mode_entry *, u_int,
u_int);
static void window_client_update(struct window_mode_entry *);
static void window_client_key(struct window_mode_entry *,
struct client *, struct session *,
struct winlink *, key_code, struct mouse_event *);
@ -59,6 +60,7 @@ const struct window_mode window_client_mode = {
.init = window_client_init,
.free = window_client_free,
.resize = window_client_resize,
.update = window_client_update,
.key = window_client_key,
};
@ -311,6 +313,16 @@ window_client_resize(struct window_mode_entry *wme, u_int sx, u_int sy)
mode_tree_resize(data->data, sx, sy);
}
static void
window_client_update(struct window_mode_entry *wme)
{
struct window_client_modedata *data = wme->data;
mode_tree_build(data->data);
mode_tree_draw(data->data);
data->wp->flags |= PANE_REDRAW;
}
static void
window_client_do_detach(void *modedata, void *itemdata,
__unused struct client *c, key_code key)

View File

@ -29,6 +29,7 @@ static struct screen *window_tree_init(struct window_mode_entry *,
static void window_tree_free(struct window_mode_entry *);
static void window_tree_resize(struct window_mode_entry *, u_int,
u_int);
static void window_tree_update(struct window_mode_entry *);
static void window_tree_key(struct window_mode_entry *,
struct client *, struct session *,
struct winlink *, key_code, struct mouse_event *);
@ -79,6 +80,7 @@ const struct window_mode window_tree_mode = {
.init = window_tree_init,
.free = window_tree_free,
.resize = window_tree_resize,
.update = window_tree_update,
.key = window_tree_key,
};
@ -937,6 +939,16 @@ window_tree_resize(struct window_mode_entry *wme, u_int sx, u_int sy)
mode_tree_resize(data->data, sx, sy);
}
static void
window_tree_update(struct window_mode_entry *wme)
{
struct window_tree_modedata *data = wme->data;
mode_tree_build(data->data);
mode_tree_draw(data->data);
data->wp->flags |= PANE_REDRAW;
}
static char *
window_tree_get_target(struct window_tree_itemdata *item,
struct cmd_find_state *fs)