mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Permit options such as status-bg to be configured using the entire 256 colour
palette by setting "colour0" to "colour255".
This commit is contained in:
		
							
								
								
									
										4
									
								
								clock.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								clock.c
									
									
									
									
									
								
							@@ -120,7 +120,7 @@ clock_draw(struct screen_write_ctx *ctx, u_int colour, int style)
 | 
			
		||||
			screen_write_cursormove(ctx, x, y);
 | 
			
		||||
 | 
			
		||||
			memcpy(&gc, &grid_default_cell, sizeof gc);
 | 
			
		||||
			gc.fg = colour;
 | 
			
		||||
			colour_set_fg(&gc, colour);
 | 
			
		||||
			screen_write_puts(ctx, &gc, "%s", tim);
 | 
			
		||||
		}
 | 
			
		||||
		return;
 | 
			
		||||
@@ -130,7 +130,7 @@ clock_draw(struct screen_write_ctx *ctx, u_int colour, int style)
 | 
			
		||||
	y = (screen_size_y(s) / 2) - 3;
 | 
			
		||||
 | 
			
		||||
	memcpy(&gc, &grid_default_cell, sizeof gc);
 | 
			
		||||
	gc.bg = colour;
 | 
			
		||||
	colour_set_bg(&gc, colour);
 | 
			
		||||
	for (ptr = tim; *ptr != '\0'; ptr++) {
 | 
			
		||||
		if (*ptr >= '0' && *ptr <= '9')
 | 
			
		||||
			idx = *ptr - '0';
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										43
									
								
								colour.c
									
									
									
									
									
								
							
							
						
						
									
										43
									
								
								colour.c
									
									
									
									
									
								
							@@ -18,13 +18,42 @@
 | 
			
		||||
 | 
			
		||||
#include <sys/types.h>
 | 
			
		||||
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
#include "tmux.h"
 | 
			
		||||
 | 
			
		||||
const char *
 | 
			
		||||
colour_tostring(u_char c)
 | 
			
		||||
/*
 | 
			
		||||
 * Colour to string conversion functions. Bit 8 of the colour means it is one
 | 
			
		||||
 * of the 256 colour palette.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
colour_set_fg(struct grid_cell *gc, int c)
 | 
			
		||||
{
 | 
			
		||||
	if (c & 0x100)
 | 
			
		||||
		gc->flags |= GRID_FLAG_FG256;
 | 
			
		||||
	gc->fg = c;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
colour_set_bg(struct grid_cell *gc, int c)
 | 
			
		||||
{
 | 
			
		||||
	if (c & 0x100)
 | 
			
		||||
		gc->flags |= GRID_FLAG_BG256;
 | 
			
		||||
	gc->bg = c;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const char *
 | 
			
		||||
colour_tostring(int c)
 | 
			
		||||
{
 | 
			
		||||
	static char	s[32];
 | 
			
		||||
 | 
			
		||||
	if (c & 0x100) {
 | 
			
		||||
		xsnprintf(s, sizeof s, "colour%u", c & ~0x100);
 | 
			
		||||
		return (s);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	switch (c) {
 | 
			
		||||
	case 0:
 | 
			
		||||
		return ("black");
 | 
			
		||||
@@ -51,6 +80,16 @@ colour_tostring(u_char c)
 | 
			
		||||
int
 | 
			
		||||
colour_fromstring(const char *s)
 | 
			
		||||
{
 | 
			
		||||
	const char	*errstr;
 | 
			
		||||
	int		 n;
 | 
			
		||||
 | 
			
		||||
	if (strncasecmp(s, "colour", (sizeof "colour") - 1) == 0) {
 | 
			
		||||
		n = strtonum(s + (sizeof "colour") - 1, 0, 255, &errstr);
 | 
			
		||||
		if (errstr != NULL)
 | 
			
		||||
			return (-1);
 | 
			
		||||
		return (n | 0x100);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (strcasecmp(s, "black") == 0 || (s[0] == '0' && s[1] == '\0'))
 | 
			
		||||
		return (0);
 | 
			
		||||
	if (strcasecmp(s, "red") == 0 || (s[0] == '1' && s[1] == '\0'))
 | 
			
		||||
 
 | 
			
		||||
@@ -240,7 +240,7 @@ screen_redraw_draw_number(struct client *c, struct window_pane *wp)
 | 
			
		||||
	struct session		*s = c->session;
 | 
			
		||||
	struct grid_cell	 gc;
 | 
			
		||||
	u_int			 idx, px, py, i, j;
 | 
			
		||||
	u_char			 colour;
 | 
			
		||||
	int			 colour;
 | 
			
		||||
	char			 buf[16], *ptr;
 | 
			
		||||
	size_t			 len;
 | 
			
		||||
 | 
			
		||||
@@ -256,7 +256,7 @@ screen_redraw_draw_number(struct client *c, struct window_pane *wp)
 | 
			
		||||
	if (wp->sx < len * 6 || wp->sy < 5) {
 | 
			
		||||
		tty_cursor(tty, px - len / 2, py, wp->xoff, wp->yoff);
 | 
			
		||||
		memcpy(&gc, &grid_default_cell, sizeof gc);
 | 
			
		||||
		gc.fg = colour;
 | 
			
		||||
		colour_set_fg(&gc, colour);
 | 
			
		||||
		tty_attributes(tty, &gc);
 | 
			
		||||
		tty_puts(tty, buf);
 | 
			
		||||
		return;
 | 
			
		||||
@@ -266,7 +266,7 @@ screen_redraw_draw_number(struct client *c, struct window_pane *wp)
 | 
			
		||||
	py -= 2;
 | 
			
		||||
 | 
			
		||||
	memcpy(&gc, &grid_default_cell, sizeof gc);
 | 
			
		||||
	gc.bg = colour;
 | 
			
		||||
	colour_set_bg(&gc, colour);
 | 
			
		||||
	tty_attributes(tty, &gc);
 | 
			
		||||
	for (ptr = buf; *ptr != '\0'; ptr++) {
 | 
			
		||||
		if (*ptr < '0' || *ptr > '9')
 | 
			
		||||
@@ -276,9 +276,8 @@ screen_redraw_draw_number(struct client *c, struct window_pane *wp)
 | 
			
		||||
		for (j = 0; j < 5; j++) {
 | 
			
		||||
			for (i = px; i < px + 5; i++) {
 | 
			
		||||
				tty_cursor(tty, i, py + j, wp->xoff, wp->yoff);
 | 
			
		||||
				if (!clock_table[idx][j][i - px])
 | 
			
		||||
					continue;
 | 
			
		||||
				tty_putc(tty, ' ');
 | 
			
		||||
				if (clock_table[idx][j][i - px])
 | 
			
		||||
					tty_putc(tty, ' ');
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		px += 6;
 | 
			
		||||
 
 | 
			
		||||
@@ -300,7 +300,7 @@ screen_write_parsestyle(
 | 
			
		||||
	char		tmp[32];
 | 
			
		||||
	int		val;
 | 
			
		||||
	size_t		end;
 | 
			
		||||
	u_char		fg, bg, attr;
 | 
			
		||||
	u_char		fg, bg, attr, flags;
 | 
			
		||||
 | 
			
		||||
	if (*in == '\0')
 | 
			
		||||
		return;
 | 
			
		||||
@@ -309,7 +309,8 @@ screen_write_parsestyle(
 | 
			
		||||
 | 
			
		||||
	fg = gc->fg;
 | 
			
		||||
	bg = gc->bg;
 | 
			
		||||
	attr = 0;
 | 
			
		||||
	attr = gc->attr;
 | 
			
		||||
	flags = gc->flags;
 | 
			
		||||
	do {
 | 
			
		||||
		end = strcspn(in, delimiters);
 | 
			
		||||
		if (end > (sizeof tmp) - 1)
 | 
			
		||||
@@ -325,14 +326,24 @@ screen_write_parsestyle(
 | 
			
		||||
			if ((val = colour_fromstring(tmp + 3)) == -1)
 | 
			
		||||
				return;
 | 
			
		||||
			if (*in == 'f' || *in == 'F') {
 | 
			
		||||
				if (val != 8)
 | 
			
		||||
				if (val != 8) {
 | 
			
		||||
					if (val & 0x100) {
 | 
			
		||||
						flags |= GRID_FLAG_FG256;
 | 
			
		||||
						val &= ~0x100;
 | 
			
		||||
					} else
 | 
			
		||||
						flags &= ~GRID_FLAG_FG256;
 | 
			
		||||
					fg = val;
 | 
			
		||||
				else
 | 
			
		||||
				} else
 | 
			
		||||
					fg = defgc->fg;
 | 
			
		||||
			} else if (*in == 'b' || *in == 'B') {
 | 
			
		||||
				if (val != 8)
 | 
			
		||||
				if (val != 8) {
 | 
			
		||||
					if (val & 0x100) {
 | 
			
		||||
						flags |= GRID_FLAG_BG256;
 | 
			
		||||
						val &= ~0x100;
 | 
			
		||||
					} else
 | 
			
		||||
						flags &= ~GRID_FLAG_BG256;
 | 
			
		||||
					bg = val;
 | 
			
		||||
				else
 | 
			
		||||
				} else
 | 
			
		||||
					bg = defgc->bg;
 | 
			
		||||
			} else
 | 
			
		||||
				return;
 | 
			
		||||
@@ -347,6 +358,7 @@ screen_write_parsestyle(
 | 
			
		||||
	gc->fg = fg;
 | 
			
		||||
	gc->bg = bg;
 | 
			
		||||
	gc->attr = attr;
 | 
			
		||||
	gc->flags = flags;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Copy from another screen. */
 | 
			
		||||
@@ -1002,7 +1014,8 @@ screen_write_cell(
 | 
			
		||||
	if (screen_check_selection(s, s->cx - width, s->cy)) {
 | 
			
		||||
		memcpy(&tmp_gc2, &s->sel.cell, sizeof tmp_gc2);
 | 
			
		||||
		tmp_gc2.data = gc->data;
 | 
			
		||||
		tmp_gc2.flags = gc->flags;
 | 
			
		||||
		tmp_gc2.flags = gc->flags & ~(GRID_FLAG_FG256|GRID_FLAG_BG256);
 | 
			
		||||
		tmp_gc2.flags |= s->sel.cell.flags & (GRID_FLAG_FG256|GRID_FLAG_BG256);
 | 
			
		||||
		ttyctx.cell = &tmp_gc2;
 | 
			
		||||
		tty_write(tty_cmd_cell, &ttyctx);
 | 
			
		||||
	} else {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								server.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								server.c
									
									
									
									
									
								
							@@ -601,7 +601,7 @@ server_redraw_locked(struct client *c)
 | 
			
		||||
	style = options_get_number(&global_w_options, "clock-mode-style");
 | 
			
		||||
 | 
			
		||||
	memcpy(&gc, &grid_default_cell, sizeof gc);
 | 
			
		||||
	gc.fg = colour;
 | 
			
		||||
	colour_set_fg(&gc, colour);
 | 
			
		||||
	gc.attr |= GRID_ATTR_BRIGHT;
 | 
			
		||||
 | 
			
		||||
	screen_init(&screen, xx, yy, 0);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										45
									
								
								status.c
									
									
									
									
									
								
							
							
						
						
									
										45
									
								
								status.c
									
									
									
									
									
								
							@@ -66,8 +66,8 @@ status_redraw(struct client *c)
 | 
			
		||||
	if (gettimeofday(&c->status_timer, NULL) != 0)
 | 
			
		||||
		fatal("gettimeofday");
 | 
			
		||||
	memcpy(&stdgc, &grid_default_cell, sizeof gc);
 | 
			
		||||
	stdgc.fg = options_get_number(&s->options, "status-fg");
 | 
			
		||||
	stdgc.bg = options_get_number(&s->options, "status-bg");
 | 
			
		||||
	colour_set_fg(&stdgc, options_get_number(&s->options, "status-fg"));
 | 
			
		||||
	colour_set_bg(&stdgc, options_get_number(&s->options, "status-bg"));
 | 
			
		||||
	stdgc.attr |= options_get_number(&s->options, "status-attr");
 | 
			
		||||
 | 
			
		||||
	/* 
 | 
			
		||||
@@ -79,19 +79,19 @@ status_redraw(struct client *c)
 | 
			
		||||
	memcpy(&sr_stdgc, &stdgc, sizeof sr_stdgc);
 | 
			
		||||
	sl_fg = options_get_number(&s->options, "status-left-fg");
 | 
			
		||||
	if (sl_fg != 8)
 | 
			
		||||
		sl_stdgc.fg = sl_fg;
 | 
			
		||||
		colour_set_fg(&sl_stdgc, sl_fg);
 | 
			
		||||
	sl_bg = options_get_number(&s->options, "status-left-bg");
 | 
			
		||||
	if (sl_bg != 8)
 | 
			
		||||
		sl_stdgc.bg = sl_bg;		
 | 
			
		||||
		colour_set_bg(&sl_stdgc, sl_bg);
 | 
			
		||||
	sl_attr = options_get_number(&s->options, "status-left-attr");
 | 
			
		||||
	if (sl_attr != 0)
 | 
			
		||||
		sl_stdgc.attr = sl_attr;
 | 
			
		||||
	sr_fg = options_get_number(&s->options, "status-right-fg");
 | 
			
		||||
	if (sr_fg != 8)
 | 
			
		||||
		sr_stdgc.fg = sr_fg;
 | 
			
		||||
		colour_set_fg(&sr_stdgc, sr_fg);
 | 
			
		||||
	sr_bg = options_get_number(&s->options, "status-right-bg");
 | 
			
		||||
	if (sr_bg != 8)
 | 
			
		||||
		sr_stdgc.bg = sr_bg;
 | 
			
		||||
		colour_set_bg(&sr_stdgc, sr_bg);
 | 
			
		||||
	sr_attr = options_get_number(&s->options, "status-right-attr");
 | 
			
		||||
	if (sr_attr != 0)
 | 
			
		||||
		sr_stdgc.attr = sr_attr;
 | 
			
		||||
@@ -501,16 +501,17 @@ status_width(struct winlink *wl)
 | 
			
		||||
char *
 | 
			
		||||
status_print(struct session *s, struct winlink *wl, struct grid_cell *gc)
 | 
			
		||||
{
 | 
			
		||||
	char   *text, flag;
 | 
			
		||||
	u_char	fg, bg, attr;
 | 
			
		||||
	struct options	*oo = &wl->window->options;
 | 
			
		||||
	char   		*text, flag;
 | 
			
		||||
	u_char		 fg, bg, attr;
 | 
			
		||||
 | 
			
		||||
	fg = options_get_number(&wl->window->options, "window-status-fg");
 | 
			
		||||
	fg = options_get_number(oo, "window-status-fg");
 | 
			
		||||
	if (fg != 8)
 | 
			
		||||
		gc->fg = fg;
 | 
			
		||||
	bg = options_get_number(&wl->window->options, "window-status-bg");
 | 
			
		||||
		colour_set_fg(gc, fg);
 | 
			
		||||
	bg = options_get_number(oo, "window-status-bg");
 | 
			
		||||
	if (bg != 8)
 | 
			
		||||
		gc->bg = bg;
 | 
			
		||||
	attr = options_get_number(&wl->window->options, "window-status-attr");
 | 
			
		||||
		colour_set_bg(gc, bg);
 | 
			
		||||
	attr = options_get_number(oo, "window-status-attr");
 | 
			
		||||
	if (attr != 0)
 | 
			
		||||
		gc->attr = attr;
 | 
			
		||||
 | 
			
		||||
@@ -518,13 +519,13 @@ status_print(struct session *s, struct winlink *wl, struct grid_cell *gc)
 | 
			
		||||
 	if (wl == SLIST_FIRST(&s->lastw))
 | 
			
		||||
		flag = '-';
 | 
			
		||||
	if (wl == s->curw) {
 | 
			
		||||
		fg = options_get_number(&wl->window->options, "window-status-current-fg");
 | 
			
		||||
		fg = options_get_number(oo, "window-status-current-fg");
 | 
			
		||||
		if (fg != 8)
 | 
			
		||||
			gc->fg = fg;
 | 
			
		||||
		bg = options_get_number(&wl->window->options, "window-status-current-bg");
 | 
			
		||||
			colour_set_fg(gc, fg);
 | 
			
		||||
		bg = options_get_number(oo, "window-status-current-bg");
 | 
			
		||||
		if (bg != 8)
 | 
			
		||||
			gc->bg = bg;
 | 
			
		||||
		attr = options_get_number(&wl->window->options, "window-status-current-attr");
 | 
			
		||||
			colour_set_bg(gc, bg);
 | 
			
		||||
		attr = options_get_number(oo, "window-status-current-attr");
 | 
			
		||||
		if (attr != 0)
 | 
			
		||||
			gc->attr = attr;
 | 
			
		||||
		flag = '*';
 | 
			
		||||
@@ -606,8 +607,8 @@ status_message_redraw(struct client *c)
 | 
			
		||||
		len = c->tty.sx;
 | 
			
		||||
 | 
			
		||||
	memcpy(&gc, &grid_default_cell, sizeof gc);
 | 
			
		||||
	gc.fg = options_get_number(&s->options, "message-fg");
 | 
			
		||||
	gc.bg = options_get_number(&s->options, "message-bg");
 | 
			
		||||
	colour_set_fg(&gc, options_get_number(&s->options, "message-fg"));
 | 
			
		||||
	colour_set_bg(&gc, options_get_number(&s->options, "message-bg"));
 | 
			
		||||
	gc.attr |= options_get_number(&s->options, "message-attr");
 | 
			
		||||
 | 
			
		||||
	screen_write_start(&ctx, NULL, &c->status);
 | 
			
		||||
@@ -719,8 +720,8 @@ status_prompt_redraw(struct client *c)
 | 
			
		||||
		len = c->tty.sx;
 | 
			
		||||
 | 
			
		||||
	memcpy(&gc, &grid_default_cell, sizeof gc);
 | 
			
		||||
	gc.fg = options_get_number(&s->options, "message-fg");
 | 
			
		||||
	gc.bg = options_get_number(&s->options, "message-bg");
 | 
			
		||||
	colour_set_fg(&gc, options_get_number(&s->options, "message-fg"));
 | 
			
		||||
	colour_set_bg(&gc, options_get_number(&s->options, "message-bg"));
 | 
			
		||||
	gc.attr |= options_get_number(&s->options, "message-attr");
 | 
			
		||||
 | 
			
		||||
	screen_write_start(&ctx, NULL, &c->status);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										7
									
								
								tmux.1
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								tmux.1
									
									
									
									
									
								
							@@ -1250,8 +1250,11 @@ is one of:
 | 
			
		||||
.Ic blue ,
 | 
			
		||||
.Ic magenta ,
 | 
			
		||||
.Ic cyan ,
 | 
			
		||||
.Ic white
 | 
			
		||||
or
 | 
			
		||||
.Ic white ,
 | 
			
		||||
.Ic colour0
 | 
			
		||||
to
 | 
			
		||||
.Ic colour255
 | 
			
		||||
from the 256-colour palette, or
 | 
			
		||||
.Ic default .
 | 
			
		||||
.It Ic message-fg Ar colour
 | 
			
		||||
Set status line message foreground colour.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								tmux.h
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								tmux.h
									
									
									
									
									
								
							@@ -1486,7 +1486,9 @@ void	 input_key(struct window_pane *, int);
 | 
			
		||||
void	 input_mouse(struct window_pane *, u_char, u_char, u_char);
 | 
			
		||||
 | 
			
		||||
/* colour.c */
 | 
			
		||||
const char *colour_tostring(u_char);
 | 
			
		||||
void	 colour_set_fg(struct grid_cell *, int);
 | 
			
		||||
void	 colour_set_bg(struct grid_cell *, int);
 | 
			
		||||
const char *colour_tostring(int);
 | 
			
		||||
int	 colour_fromstring(const char *);
 | 
			
		||||
u_char	 colour_256to16(u_char);
 | 
			
		||||
u_char	 colour_256to88(u_char);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										3
									
								
								tty.c
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								tty.c
									
									
									
									
									
								
							@@ -512,7 +512,8 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int py, u_int ox, u_int oy)
 | 
			
		||||
		if (screen_check_selection(s, i, py)) {
 | 
			
		||||
			memcpy(&tmpgc, &s->sel.cell, sizeof tmpgc);
 | 
			
		||||
			tmpgc.data = gc->data;
 | 
			
		||||
			tmpgc.flags = gc->flags;
 | 
			
		||||
			tmpgc.flags = gc->flags & ~(GRID_FLAG_FG256|GRID_FLAG_BG256);
 | 
			
		||||
			tmpgc.flags |= s->sel.cell.flags & (GRID_FLAG_FG256|GRID_FLAG_BG256);
 | 
			
		||||
			tty_cell(tty, &tmpgc, gu);
 | 
			
		||||
		} else
 | 
			
		||||
			tty_cell(tty, gc, gu);
 | 
			
		||||
 
 | 
			
		||||
@@ -295,6 +295,7 @@ window_choose_write_line(
 | 
			
		||||
{
 | 
			
		||||
	struct window_choose_mode_data	*data = wp->modedata;
 | 
			
		||||
	struct window_choose_mode_item	*item;
 | 
			
		||||
	struct options			*oo = &wp->window->options;
 | 
			
		||||
	struct screen			*s = &data->screen;
 | 
			
		||||
	struct grid_cell		 gc;
 | 
			
		||||
 	int				 utf8flag;
 | 
			
		||||
@@ -305,9 +306,9 @@ window_choose_write_line(
 | 
			
		||||
	utf8flag = options_get_number(&wp->window->options, "utf8");
 | 
			
		||||
	memcpy(&gc, &grid_default_cell, sizeof gc);
 | 
			
		||||
	if (data->selected == data->top + py) {
 | 
			
		||||
		gc.fg = options_get_number(&wp->window->options, "mode-fg");
 | 
			
		||||
		gc.bg = options_get_number(&wp->window->options, "mode-bg");
 | 
			
		||||
		gc.attr |= options_get_number(&wp->window->options, "mode-attr");
 | 
			
		||||
		colour_set_fg(&gc, options_get_number(oo, "mode-fg"));
 | 
			
		||||
		colour_set_bg(&gc, options_get_number(oo, "mode-bg"));
 | 
			
		||||
		gc.attr |= options_get_number(oo, "mode-attr");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	screen_write_cursormove(ctx, 0, py);
 | 
			
		||||
 
 | 
			
		||||
@@ -660,14 +660,15 @@ window_copy_write_line(
 | 
			
		||||
{
 | 
			
		||||
	struct window_copy_mode_data	*data = wp->modedata;
 | 
			
		||||
	struct screen			*s = &data->screen;
 | 
			
		||||
	struct options			*oo = &wp->window->options;
 | 
			
		||||
	struct grid_cell		 gc;
 | 
			
		||||
	char				 hdr[32];
 | 
			
		||||
	size_t	 			 last, xoff = 0, size = 0;
 | 
			
		||||
 | 
			
		||||
	memcpy(&gc, &grid_default_cell, sizeof gc);
 | 
			
		||||
	gc.fg = options_get_number(&wp->window->options, "mode-fg");
 | 
			
		||||
	gc.bg = options_get_number(&wp->window->options, "mode-bg");
 | 
			
		||||
	gc.attr |= options_get_number(&wp->window->options, "mode-attr");
 | 
			
		||||
	colour_set_fg(&gc, options_get_number(oo, "mode-fg"));
 | 
			
		||||
	colour_set_bg(&gc, options_get_number(oo, "mode-bg"));
 | 
			
		||||
	gc.attr |= options_get_number(oo, "mode-attr");
 | 
			
		||||
 | 
			
		||||
	last = screen_size_y(s) - 1;
 | 
			
		||||
	if (py == 0) {
 | 
			
		||||
@@ -765,6 +766,7 @@ window_copy_update_selection(struct window_pane *wp)
 | 
			
		||||
{
 | 
			
		||||
	struct window_copy_mode_data	*data = wp->modedata;
 | 
			
		||||
	struct screen			*s = &data->screen;
 | 
			
		||||
	struct options			*oo = &wp->window->options;
 | 
			
		||||
	struct grid_cell		 gc;
 | 
			
		||||
	u_int				 sx, sy, ty;
 | 
			
		||||
 | 
			
		||||
@@ -773,9 +775,9 @@ window_copy_update_selection(struct window_pane *wp)
 | 
			
		||||
 | 
			
		||||
	/* Set colours. */
 | 
			
		||||
	memcpy(&gc, &grid_default_cell, sizeof gc);
 | 
			
		||||
	gc.fg = options_get_number(&wp->window->options, "mode-fg");
 | 
			
		||||
	gc.bg = options_get_number(&wp->window->options, "mode-bg");
 | 
			
		||||
	gc.attr |= options_get_number(&wp->window->options, "mode-attr");
 | 
			
		||||
	colour_set_fg(&gc, options_get_number(oo, "mode-fg"));
 | 
			
		||||
	colour_set_bg(&gc, options_get_number(oo, "mode-bg"));
 | 
			
		||||
	gc.attr |= options_get_number(oo, "mode-attr");
 | 
			
		||||
 | 
			
		||||
	/* Find top of screen. */
 | 
			
		||||
	ty = screen_hsize(&wp->base) - data->oy;
 | 
			
		||||
 
 | 
			
		||||
@@ -164,6 +164,7 @@ window_more_write_line(
 | 
			
		||||
{
 | 
			
		||||
	struct window_more_mode_data	*data = wp->modedata;
 | 
			
		||||
	struct screen			*s = &data->screen;
 | 
			
		||||
	struct options			*oo = &wp->window->options;	
 | 
			
		||||
	struct grid_cell		 gc;
 | 
			
		||||
	char   				*msg, hdr[32];
 | 
			
		||||
	size_t	 			 size;
 | 
			
		||||
@@ -176,9 +177,9 @@ window_more_write_line(
 | 
			
		||||
		size = xsnprintf(hdr, sizeof hdr,
 | 
			
		||||
		    "[%u/%u]", data->top, ARRAY_LENGTH(&data->list));
 | 
			
		||||
		screen_write_cursormove(ctx, screen_size_x(s) - size, 0);
 | 
			
		||||
		gc.fg = options_get_number(&wp->window->options, "mode-fg");
 | 
			
		||||
		gc.bg = options_get_number(&wp->window->options, "mode-bg");
 | 
			
		||||
		gc.attr |= options_get_number(&wp->window->options, "mode-attr");
 | 
			
		||||
		colour_set_fg(&gc, options_get_number(oo, "mode-fg"));
 | 
			
		||||
		colour_set_bg(&gc, options_get_number(oo, "mode-bg"));
 | 
			
		||||
		gc.attr |= options_get_number(oo, "mode-attr");
 | 
			
		||||
		screen_write_puts(ctx, &gc, "%s", hdr);
 | 
			
		||||
		memcpy(&gc, &grid_default_cell, sizeof gc);
 | 
			
		||||
	} else
 | 
			
		||||
 
 | 
			
		||||
@@ -192,6 +192,7 @@ window_scroll_write_line(
 | 
			
		||||
{
 | 
			
		||||
	struct window_scroll_mode_data	*data = wp->modedata;
 | 
			
		||||
	struct screen			*s = &data->screen;
 | 
			
		||||
	struct options			*oo = &wp->window->options;
 | 
			
		||||
	struct grid_cell		 gc;
 | 
			
		||||
	char				 hdr[32];
 | 
			
		||||
	size_t	 			 size;
 | 
			
		||||
@@ -200,9 +201,9 @@ window_scroll_write_line(
 | 
			
		||||
		memcpy(&gc, &grid_default_cell, sizeof gc);
 | 
			
		||||
		size = xsnprintf(hdr, sizeof hdr,
 | 
			
		||||
		    "[%u,%u/%u]", data->ox, data->oy, screen_hsize(&wp->base));
 | 
			
		||||
		gc.fg = options_get_number(&wp->window->options, "mode-fg");
 | 
			
		||||
		gc.bg = options_get_number(&wp->window->options, "mode-bg");
 | 
			
		||||
		gc.attr |= options_get_number(&wp->window->options, "mode-attr");
 | 
			
		||||
		colour_set_fg(&gc, options_get_number(oo, "mode-fg"));
 | 
			
		||||
		colour_set_bg(&gc, options_get_number(oo, "mode-bg"));
 | 
			
		||||
		gc.attr |= options_get_number(oo, "mode-attr");
 | 
			
		||||
		screen_write_cursormove(ctx, screen_size_x(s) - size, 0);
 | 
			
		||||
		screen_write_puts(ctx, &gc, "%s", hdr);
 | 
			
		||||
		memcpy(&gc, &grid_default_cell, sizeof gc);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user