mirror of
https://github.com/tmux/tmux.git
synced 2025-09-02 05:21:10 +00:00
Merge branch 'obsd-master' into master
This commit is contained in:
70
window.c
70
window.c
@ -485,6 +485,14 @@ window_set_active_pane(struct window *w, struct window_pane *wp, int notify)
|
||||
return (1);
|
||||
}
|
||||
|
||||
static int
|
||||
window_pane_get_palette(struct window_pane *wp, int c)
|
||||
{
|
||||
if (wp == NULL)
|
||||
return (-1);
|
||||
return (colour_palette_get(&wp->palette, c));
|
||||
}
|
||||
|
||||
void
|
||||
window_redraw_active_switch(struct window *w, struct window_pane *wp)
|
||||
{
|
||||
@ -862,9 +870,6 @@ window_pane_create(struct window *w, u_int sx, u_int sy, u_int hlimit)
|
||||
|
||||
wp->fd = -1;
|
||||
|
||||
wp->fg = 8;
|
||||
wp->bg = 8;
|
||||
|
||||
TAILQ_INIT(&wp->modes);
|
||||
|
||||
TAILQ_INIT (&wp->resize_queue);
|
||||
@ -874,6 +879,7 @@ window_pane_create(struct window *w, u_int sx, u_int sy, u_int hlimit)
|
||||
|
||||
wp->pipe_fd = -1;
|
||||
|
||||
colour_palette_init(&wp->palette);
|
||||
screen_init(&wp->base, sx, sy, hlimit);
|
||||
wp->screen = &wp->base;
|
||||
|
||||
@ -926,7 +932,7 @@ window_pane_destroy(struct window_pane *wp)
|
||||
free((void *)wp->cwd);
|
||||
free(wp->shell);
|
||||
cmd_free_argv(wp->argc, wp->argv);
|
||||
free(wp->palette);
|
||||
colour_palette_free(&wp->palette);
|
||||
free(wp);
|
||||
}
|
||||
|
||||
@ -978,7 +984,7 @@ window_pane_set_event(struct window_pane *wp)
|
||||
|
||||
wp->event = bufferevent_new(wp->fd, window_pane_read_callback,
|
||||
NULL, window_pane_error_callback, wp);
|
||||
wp->ictx = input_init(wp, wp->event);
|
||||
wp->ictx = input_init(wp, wp->event, &wp->palette);
|
||||
|
||||
bufferevent_enable(wp->event, EV_READ|EV_WRITE);
|
||||
}
|
||||
@ -1010,60 +1016,6 @@ window_pane_resize(struct window_pane *wp, u_int sx, u_int sy)
|
||||
wme->mode->resize(wme, sx, sy);
|
||||
}
|
||||
|
||||
void
|
||||
window_pane_set_palette(struct window_pane *wp, u_int n, int colour)
|
||||
{
|
||||
if (n > 0xff)
|
||||
return;
|
||||
|
||||
if (wp->palette == NULL)
|
||||
wp->palette = xcalloc(0x100, sizeof *wp->palette);
|
||||
|
||||
wp->palette[n] = colour;
|
||||
wp->flags |= PANE_REDRAW;
|
||||
}
|
||||
|
||||
void
|
||||
window_pane_unset_palette(struct window_pane *wp, u_int n)
|
||||
{
|
||||
if (n > 0xff || wp->palette == NULL)
|
||||
return;
|
||||
|
||||
wp->palette[n] = 0;
|
||||
wp->flags |= PANE_REDRAW;
|
||||
}
|
||||
|
||||
void
|
||||
window_pane_reset_palette(struct window_pane *wp)
|
||||
{
|
||||
if (wp->palette == NULL)
|
||||
return;
|
||||
|
||||
free(wp->palette);
|
||||
wp->palette = NULL;
|
||||
wp->flags |= PANE_REDRAW;
|
||||
}
|
||||
|
||||
int
|
||||
window_pane_get_palette(struct window_pane *wp, int c)
|
||||
{
|
||||
int new;
|
||||
|
||||
if (wp == NULL || wp->palette == NULL)
|
||||
return (-1);
|
||||
|
||||
new = -1;
|
||||
if (c < 8)
|
||||
new = wp->palette[c];
|
||||
else if (c >= 90 && c <= 97)
|
||||
new = wp->palette[8 + c - 90];
|
||||
else if (c & COLOUR_FLAG_256)
|
||||
new = wp->palette[c & ~COLOUR_FLAG_256];
|
||||
if (new == 0)
|
||||
return (-1);
|
||||
return (new);
|
||||
}
|
||||
|
||||
int
|
||||
window_pane_set_mode(struct window_pane *wp, struct window_pane *swp,
|
||||
const struct window_mode *mode, struct cmd_find_state *fs,
|
||||
|
Reference in New Issue
Block a user