mirror of
https://github.com/tmux/tmux.git
synced 2025-01-07 16:28:48 +00:00
Support setting the default window and pane background colours (window
and active pane via window-style and window-active-style options, an individual pane by a new select-pane -P flag). From J Raynor.
This commit is contained in:
parent
4a7587931c
commit
ee123c2489
@ -28,8 +28,8 @@ enum cmd_retval cmd_select_pane_exec(struct cmd *, struct cmd_q *);
|
|||||||
|
|
||||||
const struct cmd_entry cmd_select_pane_entry = {
|
const struct cmd_entry cmd_select_pane_entry = {
|
||||||
"select-pane", "selectp",
|
"select-pane", "selectp",
|
||||||
"DdeLlRt:U", 0, 0,
|
"DdegLlP:Rt:U", 0, 0,
|
||||||
"[-DdeLlRU] " CMD_TARGET_PANE_USAGE,
|
"[-DdegLlRU] [-P style] " CMD_TARGET_PANE_USAGE,
|
||||||
0,
|
0,
|
||||||
cmd_select_pane_exec
|
cmd_select_pane_exec
|
||||||
};
|
};
|
||||||
@ -48,6 +48,7 @@ cmd_select_pane_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||||||
struct args *args = self->args;
|
struct args *args = self->args;
|
||||||
struct winlink *wl;
|
struct winlink *wl;
|
||||||
struct window_pane *wp;
|
struct window_pane *wp;
|
||||||
|
const char *style;
|
||||||
|
|
||||||
if (self->entry == &cmd_last_pane_entry || args_has(args, 'l')) {
|
if (self->entry == &cmd_last_pane_entry || args_has(args, 'l')) {
|
||||||
wl = cmd_find_window(cmdq, args_get(args, 't'), NULL);
|
wl = cmd_find_window(cmdq, args_get(args, 't'), NULL);
|
||||||
@ -82,6 +83,21 @@ cmd_select_pane_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||||||
return (CMD_RETURN_ERROR);
|
return (CMD_RETURN_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args_has(self->args, 'P') || args_has(self->args, 'g')) {
|
||||||
|
if (args_has(args, 'P')) {
|
||||||
|
style = args_get(args, 'P');
|
||||||
|
if (style_parse(&grid_default_cell, &wp->colgc,
|
||||||
|
style) == -1) {
|
||||||
|
cmdq_error(cmdq, "bad style: %s", style);
|
||||||
|
return (CMD_RETURN_ERROR);
|
||||||
|
}
|
||||||
|
wp->flags |= PANE_REDRAW;
|
||||||
|
}
|
||||||
|
if (args_has(self->args, 'g'))
|
||||||
|
cmdq_print(cmdq, "%s", style_tostring(&wp->colgc));
|
||||||
|
return (CMD_RETURN_NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
if (args_has(self->args, 'L'))
|
if (args_has(self->args, 'L'))
|
||||||
wp = window_pane_find_left(wp);
|
wp = window_pane_find_left(wp);
|
||||||
else if (args_has(self->args, 'R'))
|
else if (args_has(self->args, 'R'))
|
||||||
|
@ -668,6 +668,16 @@ const struct options_table_entry window_options_table[] = {
|
|||||||
.default_num = 0 /* overridden in main() */
|
.default_num = 0 /* overridden in main() */
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{ .name = "window-active-style",
|
||||||
|
.type = OPTIONS_TABLE_STYLE,
|
||||||
|
.default_str = "default"
|
||||||
|
},
|
||||||
|
|
||||||
|
{ .name = "window-style",
|
||||||
|
.type = OPTIONS_TABLE_STYLE,
|
||||||
|
.default_str = "default"
|
||||||
|
},
|
||||||
|
|
||||||
{ .name = "window-status-activity-attr",
|
{ .name = "window-status-activity-attr",
|
||||||
.type = OPTIONS_TABLE_ATTRIBUTES,
|
.type = OPTIONS_TABLE_ATTRIBUTES,
|
||||||
.default_num = GRID_ATTR_REVERSE,
|
.default_num = GRID_ATTR_REVERSE,
|
||||||
|
@ -266,7 +266,7 @@ screen_redraw_pane(struct client *c, struct window_pane *wp)
|
|||||||
yoff++;
|
yoff++;
|
||||||
|
|
||||||
for (i = 0; i < wp->sy; i++)
|
for (i = 0; i < wp->sy; i++)
|
||||||
tty_draw_line(&c->tty, wp->screen, i, wp->xoff, yoff);
|
tty_draw_pane(&c->tty, wp, i, wp->xoff, yoff);
|
||||||
tty_reset(&c->tty);
|
tty_reset(&c->tty);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -323,9 +323,9 @@ screen_redraw_draw_borders(struct client *c, int status, u_int top)
|
|||||||
small && i > msgx && j == msgy)
|
small && i > msgx && j == msgy)
|
||||||
continue;
|
continue;
|
||||||
if (screen_redraw_check_active(i, j, type, w, wp))
|
if (screen_redraw_check_active(i, j, type, w, wp))
|
||||||
tty_attributes(tty, &active_gc);
|
tty_attributes(tty, &active_gc, NULL);
|
||||||
else
|
else
|
||||||
tty_attributes(tty, &other_gc);
|
tty_attributes(tty, &other_gc, NULL);
|
||||||
tty_cursor(tty, i, top + j);
|
tty_cursor(tty, i, top + j);
|
||||||
tty_putc(tty, CELL_BORDERS[type]);
|
tty_putc(tty, CELL_BORDERS[type]);
|
||||||
}
|
}
|
||||||
@ -333,7 +333,7 @@ screen_redraw_draw_borders(struct client *c, int status, u_int top)
|
|||||||
|
|
||||||
if (small) {
|
if (small) {
|
||||||
memcpy(&msg_gc, &grid_default_cell, sizeof msg_gc);
|
memcpy(&msg_gc, &grid_default_cell, sizeof msg_gc);
|
||||||
tty_attributes(tty, &msg_gc);
|
tty_attributes(tty, &msg_gc, NULL);
|
||||||
tty_cursor(tty, msgx, msgy);
|
tty_cursor(tty, msgx, msgy);
|
||||||
tty_puts(tty, msg);
|
tty_puts(tty, msg);
|
||||||
}
|
}
|
||||||
@ -346,15 +346,13 @@ screen_redraw_draw_panes(struct client *c, u_int top)
|
|||||||
struct window *w = c->session->curw->window;
|
struct window *w = c->session->curw->window;
|
||||||
struct tty *tty = &c->tty;
|
struct tty *tty = &c->tty;
|
||||||
struct window_pane *wp;
|
struct window_pane *wp;
|
||||||
struct screen *s;
|
|
||||||
u_int i;
|
u_int i;
|
||||||
|
|
||||||
TAILQ_FOREACH(wp, &w->panes, entry) {
|
TAILQ_FOREACH(wp, &w->panes, entry) {
|
||||||
if (!window_pane_visible(wp))
|
if (!window_pane_visible(wp))
|
||||||
continue;
|
continue;
|
||||||
s = wp->screen;
|
|
||||||
for (i = 0; i < wp->sy; i++)
|
for (i = 0; i < wp->sy; i++)
|
||||||
tty_draw_line(tty, s, i, wp->xoff, top + wp->yoff);
|
tty_draw_pane(tty, wp, i, wp->xoff, top + wp->yoff);
|
||||||
if (c->flags & CLIENT_IDENTIFY)
|
if (c->flags & CLIENT_IDENTIFY)
|
||||||
screen_redraw_draw_number(c, wp);
|
screen_redraw_draw_number(c, wp);
|
||||||
}
|
}
|
||||||
@ -367,9 +365,9 @@ screen_redraw_draw_status(struct client *c, u_int top)
|
|||||||
struct tty *tty = &c->tty;
|
struct tty *tty = &c->tty;
|
||||||
|
|
||||||
if (top)
|
if (top)
|
||||||
tty_draw_line(tty, &c->status, 0, 0, 0);
|
tty_draw_line(tty, NULL, &c->status, 0, 0, 0);
|
||||||
else
|
else
|
||||||
tty_draw_line(tty, &c->status, 0, 0, tty->sy - 1);
|
tty_draw_line(tty, NULL, &c->status, 0, 0, tty->sy - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Draw number on a pane. */
|
/* Draw number on a pane. */
|
||||||
@ -411,7 +409,7 @@ screen_redraw_draw_number(struct client *c, struct window_pane *wp)
|
|||||||
colour_set_bg(&gc, active_colour);
|
colour_set_bg(&gc, active_colour);
|
||||||
else
|
else
|
||||||
colour_set_bg(&gc, colour);
|
colour_set_bg(&gc, colour);
|
||||||
tty_attributes(tty, &gc);
|
tty_attributes(tty, &gc, wp);
|
||||||
for (ptr = buf; *ptr != '\0'; ptr++) {
|
for (ptr = buf; *ptr != '\0'; ptr++) {
|
||||||
if (*ptr < '0' || *ptr > '9')
|
if (*ptr < '0' || *ptr > '9')
|
||||||
continue;
|
continue;
|
||||||
@ -438,7 +436,7 @@ draw_text:
|
|||||||
colour_set_fg(&gc, active_colour);
|
colour_set_fg(&gc, active_colour);
|
||||||
else
|
else
|
||||||
colour_set_fg(&gc, colour);
|
colour_set_fg(&gc, colour);
|
||||||
tty_attributes(tty, &gc);
|
tty_attributes(tty, &gc, wp);
|
||||||
tty_puts(tty, buf);
|
tty_puts(tty, buf);
|
||||||
|
|
||||||
tty_cursor(tty, 0, 0);
|
tty_cursor(tty, 0, 0);
|
||||||
|
@ -329,8 +329,7 @@ server_client_check_mouse(struct client *c, struct window_pane *wp)
|
|||||||
if (options_get_number(oo, "mouse-select-pane") &&
|
if (options_get_number(oo, "mouse-select-pane") &&
|
||||||
(m->event == MOUSE_EVENT_DOWN || m->event == MOUSE_EVENT_WHEEL)) {
|
(m->event == MOUSE_EVENT_DOWN || m->event == MOUSE_EVENT_WHEEL)) {
|
||||||
window_set_active_at(wp->window, m->x, m->y);
|
window_set_active_at(wp->window, m->x, m->y);
|
||||||
server_status_window(wp->window);
|
server_redraw_window(wp->window);
|
||||||
server_redraw_window_borders(wp->window);
|
|
||||||
wp = wp->window->active; /* may have changed */
|
wp = wp->window->active; /* may have changed */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
41
tmux.1
41
tmux.1
@ -1730,14 +1730,17 @@ and
|
|||||||
.Ic previous-layout
|
.Ic previous-layout
|
||||||
commands.
|
commands.
|
||||||
.It Xo Ic select-pane
|
.It Xo Ic select-pane
|
||||||
.Op Fl DdeLlRU
|
.Op Fl DdegLlRU
|
||||||
|
.Op Fl P Ar style
|
||||||
.Op Fl t Ar target-pane
|
.Op Fl t Ar target-pane
|
||||||
.Xc
|
.Xc
|
||||||
.D1 (alias: Ic selectp )
|
.D1 (alias: Ic selectp )
|
||||||
Make pane
|
Make pane
|
||||||
.Ar target-pane
|
.Ar target-pane
|
||||||
the active pane in window
|
the active pane in window
|
||||||
.Ar target-window .
|
.Ar target-window ,
|
||||||
|
or set it's style (with
|
||||||
|
.Fl P ) .
|
||||||
If one of
|
If one of
|
||||||
.Fl D ,
|
.Fl D ,
|
||||||
.Fl L ,
|
.Fl L ,
|
||||||
@ -1754,6 +1757,22 @@ command.
|
|||||||
enables or
|
enables or
|
||||||
.Fl d
|
.Fl d
|
||||||
disables input to the pane.
|
disables input to the pane.
|
||||||
|
.Pp
|
||||||
|
Each pane has a style: by default the
|
||||||
|
.Ic window-style
|
||||||
|
and
|
||||||
|
.Ic window-active-style
|
||||||
|
options are used,
|
||||||
|
.Ic select-pane
|
||||||
|
.Fl P
|
||||||
|
sets the style for a single pane.
|
||||||
|
For example, to set the pane 1 background to red:
|
||||||
|
.Bd -literal -offset indent
|
||||||
|
select-pane -t:.1 -P 'bg=red'
|
||||||
|
.Ed
|
||||||
|
.Pp
|
||||||
|
.Fl g
|
||||||
|
shows the current pane style.
|
||||||
.It Xo Ic select-window
|
.It Xo Ic select-window
|
||||||
.Op Fl lnpT
|
.Op Fl lnpT
|
||||||
.Op Fl t Ar target-window
|
.Op Fl t Ar target-window
|
||||||
@ -2070,7 +2089,7 @@ also supports user options which are prefixed with a
|
|||||||
User options may have any name, so long as they are prefixed with
|
User options may have any name, so long as they are prefixed with
|
||||||
.Ql \&@ ,
|
.Ql \&@ ,
|
||||||
and be set to any string.
|
and be set to any string.
|
||||||
For example
|
For example:
|
||||||
.Bd -literal -offset indent
|
.Bd -literal -offset indent
|
||||||
$ tmux setw -q @foo "abc123"
|
$ tmux setw -q @foo "abc123"
|
||||||
$ tmux showw -v @foo
|
$ tmux showw -v @foo
|
||||||
@ -2936,6 +2955,14 @@ Instructs
|
|||||||
.Nm
|
.Nm
|
||||||
to expect UTF-8 sequences to appear in this window.
|
to expect UTF-8 sequences to appear in this window.
|
||||||
.Pp
|
.Pp
|
||||||
|
.It Ic window-active-style Ar style
|
||||||
|
Set the style for the window's active pane.
|
||||||
|
For how to specify
|
||||||
|
.Ar style ,
|
||||||
|
see the
|
||||||
|
.Ic message-command-style
|
||||||
|
option.
|
||||||
|
.Pp
|
||||||
.It Ic window-status-activity-style Ar style
|
.It Ic window-status-activity-style Ar style
|
||||||
Set status line style for windows with an activity alert.
|
Set status line style for windows with an activity alert.
|
||||||
For how to specify
|
For how to specify
|
||||||
@ -2993,6 +3020,14 @@ see the
|
|||||||
.Ic message-command-style
|
.Ic message-command-style
|
||||||
option.
|
option.
|
||||||
.Pp
|
.Pp
|
||||||
|
.It Ic window-style Ar style
|
||||||
|
Set the default window style.
|
||||||
|
For how to specify
|
||||||
|
.Ar style ,
|
||||||
|
see the
|
||||||
|
.Ic message-command-style
|
||||||
|
option.
|
||||||
|
.Pp
|
||||||
.It Xo Ic xterm-keys
|
.It Xo Ic xterm-keys
|
||||||
.Op Ic on | off
|
.Op Ic on | off
|
||||||
.Xc
|
.Xc
|
||||||
|
11
tmux.h
11
tmux.h
@ -156,6 +156,7 @@ enum key_code {
|
|||||||
enum tty_code_code {
|
enum tty_code_code {
|
||||||
TTYC_AX = 0,
|
TTYC_AX = 0,
|
||||||
TTYC_ACSC, /* acs_chars, ac */
|
TTYC_ACSC, /* acs_chars, ac */
|
||||||
|
TTYC_BCE, /* back_color_erase, ut */
|
||||||
TTYC_BEL, /* bell, bl */
|
TTYC_BEL, /* bell, bl */
|
||||||
TTYC_BLINK, /* enter_blink_mode, mb */
|
TTYC_BLINK, /* enter_blink_mode, mb */
|
||||||
TTYC_BOLD, /* enter_bold_mode, md */
|
TTYC_BOLD, /* enter_bold_mode, md */
|
||||||
@ -902,6 +903,8 @@ struct window_pane {
|
|||||||
|
|
||||||
struct input_ctx ictx;
|
struct input_ctx ictx;
|
||||||
|
|
||||||
|
struct grid_cell colgc;
|
||||||
|
|
||||||
int pipe_fd;
|
int pipe_fd;
|
||||||
struct bufferevent *pipe_event;
|
struct bufferevent *pipe_event;
|
||||||
size_t pipe_off;
|
size_t pipe_off;
|
||||||
@ -1606,7 +1609,8 @@ void environ_push(struct environ *);
|
|||||||
/* tty.c */
|
/* tty.c */
|
||||||
void tty_init_termios(int, struct termios *, struct bufferevent *);
|
void tty_init_termios(int, struct termios *, struct bufferevent *);
|
||||||
void tty_raw(struct tty *, const char *);
|
void tty_raw(struct tty *, const char *);
|
||||||
void tty_attributes(struct tty *, const struct grid_cell *);
|
void tty_attributes(struct tty *, const struct grid_cell *,
|
||||||
|
const struct window_pane *);
|
||||||
void tty_reset(struct tty *);
|
void tty_reset(struct tty *);
|
||||||
void tty_region_pane(struct tty *, const struct tty_ctx *, u_int, u_int);
|
void tty_region_pane(struct tty *, const struct tty_ctx *, u_int, u_int);
|
||||||
void tty_region(struct tty *, u_int, u_int);
|
void tty_region(struct tty *, u_int, u_int);
|
||||||
@ -1630,7 +1634,10 @@ void tty_stop_tty(struct tty *);
|
|||||||
void tty_set_title(struct tty *, const char *);
|
void tty_set_title(struct tty *, const char *);
|
||||||
void tty_update_mode(struct tty *, int, struct screen *);
|
void tty_update_mode(struct tty *, int, struct screen *);
|
||||||
void tty_force_cursor_colour(struct tty *, const char *);
|
void tty_force_cursor_colour(struct tty *, const char *);
|
||||||
void tty_draw_line(struct tty *, struct screen *, u_int, u_int, u_int);
|
void tty_draw_pane(struct tty *, const struct window_pane *, u_int, u_int,
|
||||||
|
u_int);
|
||||||
|
void tty_draw_line(struct tty *, const struct window_pane *, struct screen *,
|
||||||
|
u_int, u_int, u_int);
|
||||||
int tty_open(struct tty *, char **);
|
int tty_open(struct tty *, char **);
|
||||||
void tty_close(struct tty *);
|
void tty_close(struct tty *);
|
||||||
void tty_free(struct tty *);
|
void tty_free(struct tty *);
|
||||||
|
@ -35,6 +35,7 @@ struct tty_terms tty_terms = LIST_HEAD_INITIALIZER(tty_terms);
|
|||||||
const struct tty_term_code_entry tty_term_codes[NTTYCODE] = {
|
const struct tty_term_code_entry tty_term_codes[NTTYCODE] = {
|
||||||
{ TTYC_ACSC, TTYCODE_STRING, "acsc" },
|
{ TTYC_ACSC, TTYCODE_STRING, "acsc" },
|
||||||
{ TTYC_AX, TTYCODE_FLAG, "AX" },
|
{ TTYC_AX, TTYCODE_FLAG, "AX" },
|
||||||
|
{ TTYC_BCE, TTYCODE_FLAG, "bce" },
|
||||||
{ TTYC_BEL, TTYCODE_STRING, "bel" },
|
{ TTYC_BEL, TTYCODE_STRING, "bel" },
|
||||||
{ TTYC_BLINK, TTYCODE_STRING, "blink" },
|
{ TTYC_BLINK, TTYCODE_STRING, "blink" },
|
||||||
{ TTYC_BOLD, TTYCODE_STRING, "bold" },
|
{ TTYC_BOLD, TTYCODE_STRING, "bold" },
|
||||||
|
170
tty.c
170
tty.c
@ -43,11 +43,14 @@ void tty_colours_fg(struct tty *, const struct grid_cell *);
|
|||||||
void tty_colours_bg(struct tty *, const struct grid_cell *);
|
void tty_colours_bg(struct tty *, const struct grid_cell *);
|
||||||
|
|
||||||
int tty_large_region(struct tty *, const struct tty_ctx *);
|
int tty_large_region(struct tty *, const struct tty_ctx *);
|
||||||
|
int tty_fake_bce(const struct tty *, const struct window_pane *);
|
||||||
void tty_redraw_region(struct tty *, const struct tty_ctx *);
|
void tty_redraw_region(struct tty *, const struct tty_ctx *);
|
||||||
void tty_emulate_repeat(
|
void tty_emulate_repeat(
|
||||||
struct tty *, enum tty_code_code, enum tty_code_code, u_int);
|
struct tty *, enum tty_code_code, enum tty_code_code, u_int);
|
||||||
void tty_repeat_space(struct tty *, u_int);
|
void tty_repeat_space(struct tty *, u_int);
|
||||||
void tty_cell(struct tty *, const struct grid_cell *);
|
void tty_cell(struct tty *, const struct grid_cell *,
|
||||||
|
const struct window_pane *);
|
||||||
|
void tty_default_colours(struct grid_cell *, const struct window_pane *);
|
||||||
|
|
||||||
#define tty_use_acs(tty) \
|
#define tty_use_acs(tty) \
|
||||||
(tty_term_has((tty)->term, TTYC_ACSC) && !((tty)->flags & TTY_UTF8))
|
(tty_term_has((tty)->term, TTYC_ACSC) && !((tty)->flags & TTY_UTF8))
|
||||||
@ -581,6 +584,23 @@ tty_large_region(unused struct tty *tty, const struct tty_ctx *ctx)
|
|||||||
return (ctx->orlower - ctx->orupper >= screen_size_y(wp->screen) / 2);
|
return (ctx->orlower - ctx->orupper >= screen_size_y(wp->screen) / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return if BCE is needed but the terminal doesn't have it - it'll need to be
|
||||||
|
* emulated.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
tty_fake_bce(const struct tty *tty, const struct window_pane *wp)
|
||||||
|
{
|
||||||
|
struct grid_cell gc;
|
||||||
|
|
||||||
|
memcpy(&gc, &grid_default_cell, sizeof gc);
|
||||||
|
tty_default_colours(&gc, wp);
|
||||||
|
|
||||||
|
if (gc.bg == 8 && !(gc.flags & GRID_FLAG_BG256))
|
||||||
|
return (0);
|
||||||
|
return (!tty_term_flag(tty->term, TTYC_BCE));
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Redraw scroll region using data from screen (already updated). Used when
|
* Redraw scroll region using data from screen (already updated). Used when
|
||||||
* CSR not supported, or window is a pane that doesn't take up the full
|
* CSR not supported, or window is a pane that doesn't take up the full
|
||||||
@ -604,15 +624,23 @@ tty_redraw_region(struct tty *tty, const struct tty_ctx *ctx)
|
|||||||
|
|
||||||
if (ctx->ocy < ctx->orupper || ctx->ocy > ctx->orlower) {
|
if (ctx->ocy < ctx->orupper || ctx->ocy > ctx->orlower) {
|
||||||
for (i = ctx->ocy; i < screen_size_y(s); i++)
|
for (i = ctx->ocy; i < screen_size_y(s); i++)
|
||||||
tty_draw_line(tty, s, i, ctx->xoff, ctx->yoff);
|
tty_draw_pane(tty, wp, i, ctx->xoff, ctx->yoff);
|
||||||
} else {
|
} else {
|
||||||
for (i = ctx->orupper; i <= ctx->orlower; i++)
|
for (i = ctx->orupper; i <= ctx->orlower; i++)
|
||||||
tty_draw_line(tty, s, i, ctx->xoff, ctx->yoff);
|
tty_draw_pane(tty, wp, i, ctx->xoff, ctx->yoff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tty_draw_line(struct tty *tty, struct screen *s, u_int py, u_int ox, u_int oy)
|
tty_draw_pane(struct tty *tty, const struct window_pane *wp, u_int py, u_int ox,
|
||||||
|
u_int oy)
|
||||||
|
{
|
||||||
|
tty_draw_line(tty, wp, wp->screen, py, ox, oy);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
tty_draw_line(struct tty *tty, const struct window_pane *wp,
|
||||||
|
struct screen *s, u_int py, u_int ox, u_int oy)
|
||||||
{
|
{
|
||||||
const struct grid_cell *gc;
|
const struct grid_cell *gc;
|
||||||
struct grid_line *gl;
|
struct grid_line *gl;
|
||||||
@ -650,20 +678,20 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int py, u_int ox, u_int oy)
|
|||||||
~(GRID_FLAG_FG256|GRID_FLAG_BG256);
|
~(GRID_FLAG_FG256|GRID_FLAG_BG256);
|
||||||
tmpgc.flags |= s->sel.cell.flags &
|
tmpgc.flags |= s->sel.cell.flags &
|
||||||
(GRID_FLAG_FG256|GRID_FLAG_BG256);
|
(GRID_FLAG_FG256|GRID_FLAG_BG256);
|
||||||
tty_cell(tty, &tmpgc);
|
tty_cell(tty, &tmpgc, wp);
|
||||||
} else
|
} else
|
||||||
tty_cell(tty, gc);
|
tty_cell(tty, gc, wp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sx >= tty->sx) {
|
if (sx >= tty->sx) {
|
||||||
tty_update_mode(tty, tty->mode, s);
|
tty_update_mode(tty, tty->mode, s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tty_reset(tty);
|
tty_attributes(tty, &grid_default_cell, wp);
|
||||||
|
|
||||||
tty_cursor(tty, ox + sx, oy + py);
|
tty_cursor(tty, ox + sx, oy + py);
|
||||||
if (sx != screen_size_x(s) && ox + screen_size_x(s) >= tty->sx &&
|
if (sx != screen_size_x(s) && ox + screen_size_x(s) >= tty->sx &&
|
||||||
tty_term_has(tty->term, TTYC_EL))
|
tty_term_has(tty->term, TTYC_EL) && !tty_fake_bce(tty, wp))
|
||||||
tty_putcode(tty, TTYC_EL);
|
tty_putcode(tty, TTYC_EL);
|
||||||
else
|
else
|
||||||
tty_repeat_space(tty, screen_size_x(s) - sx);
|
tty_repeat_space(tty, screen_size_x(s) - sx);
|
||||||
@ -713,19 +741,19 @@ tty_cmd_insertcharacter(struct tty *tty, const struct tty_ctx *ctx)
|
|||||||
struct window_pane *wp = ctx->wp;
|
struct window_pane *wp = ctx->wp;
|
||||||
|
|
||||||
if (!tty_pane_full_width(tty, ctx)) {
|
if (!tty_pane_full_width(tty, ctx)) {
|
||||||
tty_draw_line(tty, wp->screen, ctx->ocy, ctx->xoff, ctx->yoff);
|
tty_draw_pane(tty, wp, ctx->ocy, ctx->xoff, ctx->yoff);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tty_reset(tty);
|
tty_attributes(tty, &grid_default_cell, wp);
|
||||||
|
|
||||||
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
|
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
|
||||||
|
|
||||||
if (tty_term_has(tty->term, TTYC_ICH) ||
|
if (!tty_fake_bce(tty, wp) && (tty_term_has(tty->term, TTYC_ICH) ||
|
||||||
tty_term_has(tty->term, TTYC_ICH1))
|
tty_term_has(tty->term, TTYC_ICH1)))
|
||||||
tty_emulate_repeat(tty, TTYC_ICH, TTYC_ICH1, ctx->num);
|
tty_emulate_repeat(tty, TTYC_ICH, TTYC_ICH1, ctx->num);
|
||||||
else
|
else
|
||||||
tty_draw_line(tty, wp->screen, ctx->ocy, ctx->xoff, ctx->yoff);
|
tty_draw_pane(tty, wp, ctx->ocy, ctx->xoff, ctx->yoff);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -733,14 +761,14 @@ tty_cmd_deletecharacter(struct tty *tty, const struct tty_ctx *ctx)
|
|||||||
{
|
{
|
||||||
struct window_pane *wp = ctx->wp;
|
struct window_pane *wp = ctx->wp;
|
||||||
|
|
||||||
if (!tty_pane_full_width(tty, ctx) ||
|
if (!tty_pane_full_width(tty, ctx) || tty_fake_bce(tty, wp) ||
|
||||||
(!tty_term_has(tty->term, TTYC_DCH) &&
|
(!tty_term_has(tty->term, TTYC_DCH) &&
|
||||||
!tty_term_has(tty->term, TTYC_DCH1))) {
|
!tty_term_has(tty->term, TTYC_DCH1))) {
|
||||||
tty_draw_line(tty, wp->screen, ctx->ocy, ctx->xoff, ctx->yoff);
|
tty_draw_pane(tty, wp, ctx->ocy, ctx->xoff, ctx->yoff);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tty_reset(tty);
|
tty_attributes(tty, &grid_default_cell, wp);
|
||||||
|
|
||||||
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
|
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
|
||||||
|
|
||||||
@ -754,11 +782,11 @@ tty_cmd_clearcharacter(struct tty *tty, const struct tty_ctx *ctx)
|
|||||||
{
|
{
|
||||||
u_int i;
|
u_int i;
|
||||||
|
|
||||||
tty_reset(tty);
|
tty_attributes(tty, &grid_default_cell, ctx->wp);
|
||||||
|
|
||||||
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
|
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
|
||||||
|
|
||||||
if (tty_term_has(tty->term, TTYC_ECH))
|
if (tty_term_has(tty->term, TTYC_ECH) && !tty_fake_bce(tty, ctx->wp))
|
||||||
tty_putcode1(tty, TTYC_ECH, ctx->num);
|
tty_putcode1(tty, TTYC_ECH, ctx->num);
|
||||||
else {
|
else {
|
||||||
for (i = 0; i < ctx->num; i++)
|
for (i = 0; i < ctx->num; i++)
|
||||||
@ -769,14 +797,14 @@ tty_cmd_clearcharacter(struct tty *tty, const struct tty_ctx *ctx)
|
|||||||
void
|
void
|
||||||
tty_cmd_insertline(struct tty *tty, const struct tty_ctx *ctx)
|
tty_cmd_insertline(struct tty *tty, const struct tty_ctx *ctx)
|
||||||
{
|
{
|
||||||
if (!tty_pane_full_width(tty, ctx) ||
|
if (!tty_pane_full_width(tty, ctx) || tty_fake_bce(tty, ctx->wp) ||
|
||||||
!tty_term_has(tty->term, TTYC_CSR) ||
|
!tty_term_has(tty->term, TTYC_CSR) ||
|
||||||
!tty_term_has(tty->term, TTYC_IL1)) {
|
!tty_term_has(tty->term, TTYC_IL1)) {
|
||||||
tty_redraw_region(tty, ctx);
|
tty_redraw_region(tty, ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tty_reset(tty);
|
tty_attributes(tty, &grid_default_cell, ctx->wp);
|
||||||
|
|
||||||
tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
|
tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
|
||||||
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
|
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
|
||||||
@ -787,14 +815,14 @@ tty_cmd_insertline(struct tty *tty, const struct tty_ctx *ctx)
|
|||||||
void
|
void
|
||||||
tty_cmd_deleteline(struct tty *tty, const struct tty_ctx *ctx)
|
tty_cmd_deleteline(struct tty *tty, const struct tty_ctx *ctx)
|
||||||
{
|
{
|
||||||
if (!tty_pane_full_width(tty, ctx) ||
|
if (!tty_pane_full_width(tty, ctx) || tty_fake_bce(tty, ctx->wp) ||
|
||||||
!tty_term_has(tty->term, TTYC_CSR) ||
|
!tty_term_has(tty->term, TTYC_CSR) ||
|
||||||
!tty_term_has(tty->term, TTYC_DL1)) {
|
!tty_term_has(tty->term, TTYC_DL1)) {
|
||||||
tty_redraw_region(tty, ctx);
|
tty_redraw_region(tty, ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tty_reset(tty);
|
tty_attributes(tty, &grid_default_cell, ctx->wp);
|
||||||
|
|
||||||
tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
|
tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
|
||||||
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
|
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
|
||||||
@ -808,11 +836,12 @@ tty_cmd_clearline(struct tty *tty, const struct tty_ctx *ctx)
|
|||||||
struct window_pane *wp = ctx->wp;
|
struct window_pane *wp = ctx->wp;
|
||||||
struct screen *s = wp->screen;
|
struct screen *s = wp->screen;
|
||||||
|
|
||||||
tty_reset(tty);
|
tty_attributes(tty, &grid_default_cell, wp);
|
||||||
|
|
||||||
tty_cursor_pane(tty, ctx, 0, ctx->ocy);
|
tty_cursor_pane(tty, ctx, 0, ctx->ocy);
|
||||||
|
|
||||||
if (tty_pane_full_width(tty, ctx) && tty_term_has(tty->term, TTYC_EL))
|
if (tty_pane_full_width(tty, ctx) && !tty_fake_bce(tty, wp) &&
|
||||||
|
tty_term_has(tty->term, TTYC_EL))
|
||||||
tty_putcode(tty, TTYC_EL);
|
tty_putcode(tty, TTYC_EL);
|
||||||
else
|
else
|
||||||
tty_repeat_space(tty, screen_size_x(s));
|
tty_repeat_space(tty, screen_size_x(s));
|
||||||
@ -824,11 +853,12 @@ tty_cmd_clearendofline(struct tty *tty, const struct tty_ctx *ctx)
|
|||||||
struct window_pane *wp = ctx->wp;
|
struct window_pane *wp = ctx->wp;
|
||||||
struct screen *s = wp->screen;
|
struct screen *s = wp->screen;
|
||||||
|
|
||||||
tty_reset(tty);
|
tty_attributes(tty, &grid_default_cell, wp);
|
||||||
|
|
||||||
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
|
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
|
||||||
|
|
||||||
if (tty_pane_full_width(tty, ctx) && tty_term_has(tty->term, TTYC_EL))
|
if (tty_pane_full_width(tty, ctx) &&
|
||||||
|
tty_term_has(tty->term, TTYC_EL) && !tty_fake_bce(tty, wp))
|
||||||
tty_putcode(tty, TTYC_EL);
|
tty_putcode(tty, TTYC_EL);
|
||||||
else
|
else
|
||||||
tty_repeat_space(tty, screen_size_x(s) - ctx->ocx);
|
tty_repeat_space(tty, screen_size_x(s) - ctx->ocx);
|
||||||
@ -837,9 +867,10 @@ tty_cmd_clearendofline(struct tty *tty, const struct tty_ctx *ctx)
|
|||||||
void
|
void
|
||||||
tty_cmd_clearstartofline(struct tty *tty, const struct tty_ctx *ctx)
|
tty_cmd_clearstartofline(struct tty *tty, const struct tty_ctx *ctx)
|
||||||
{
|
{
|
||||||
tty_reset(tty);
|
tty_attributes(tty, &grid_default_cell, ctx->wp);
|
||||||
|
|
||||||
if (ctx->xoff == 0 && tty_term_has(tty->term, TTYC_EL1)) {
|
if (ctx->xoff == 0 && tty_term_has(tty->term, TTYC_EL1) &&
|
||||||
|
!tty_fake_bce(tty, ctx->wp)) {
|
||||||
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
|
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
|
||||||
tty_putcode(tty, TTYC_EL1);
|
tty_putcode(tty, TTYC_EL1);
|
||||||
} else {
|
} else {
|
||||||
@ -854,14 +885,14 @@ tty_cmd_reverseindex(struct tty *tty, const struct tty_ctx *ctx)
|
|||||||
if (ctx->ocy != ctx->orupper)
|
if (ctx->ocy != ctx->orupper)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!tty_pane_full_width(tty, ctx) ||
|
if (!tty_pane_full_width(tty, ctx) || tty_fake_bce(tty, ctx->wp) ||
|
||||||
!tty_term_has(tty->term, TTYC_CSR) ||
|
!tty_term_has(tty->term, TTYC_CSR) ||
|
||||||
!tty_term_has(tty->term, TTYC_RI)) {
|
!tty_term_has(tty->term, TTYC_RI)) {
|
||||||
tty_redraw_region(tty, ctx);
|
tty_redraw_region(tty, ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tty_reset(tty);
|
tty_attributes(tty, &grid_default_cell, ctx->wp);
|
||||||
|
|
||||||
tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
|
tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
|
||||||
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->orupper);
|
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->orupper);
|
||||||
@ -877,7 +908,7 @@ tty_cmd_linefeed(struct tty *tty, const struct tty_ctx *ctx)
|
|||||||
if (ctx->ocy != ctx->orlower)
|
if (ctx->ocy != ctx->orlower)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!tty_pane_full_width(tty, ctx) ||
|
if (!tty_pane_full_width(tty, ctx) || tty_fake_bce(tty, wp) ||
|
||||||
!tty_term_has(tty->term, TTYC_CSR)) {
|
!tty_term_has(tty->term, TTYC_CSR)) {
|
||||||
if (tty_large_region(tty, ctx))
|
if (tty_large_region(tty, ctx))
|
||||||
wp->flags |= PANE_REDRAW;
|
wp->flags |= PANE_REDRAW;
|
||||||
@ -894,7 +925,7 @@ tty_cmd_linefeed(struct tty *tty, const struct tty_ctx *ctx)
|
|||||||
if (ctx->num && !(tty->term->flags & TERM_EARLYWRAP))
|
if (ctx->num && !(tty->term->flags & TERM_EARLYWRAP))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tty_reset(tty);
|
tty_attributes(tty, &grid_default_cell, wp);
|
||||||
|
|
||||||
tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
|
tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
|
||||||
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
|
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
|
||||||
@ -909,12 +940,13 @@ tty_cmd_clearendofscreen(struct tty *tty, const struct tty_ctx *ctx)
|
|||||||
struct screen *s = wp->screen;
|
struct screen *s = wp->screen;
|
||||||
u_int i, j;
|
u_int i, j;
|
||||||
|
|
||||||
tty_reset(tty);
|
tty_attributes(tty, &grid_default_cell, wp);
|
||||||
|
|
||||||
tty_region_pane(tty, ctx, 0, screen_size_y(s) - 1);
|
tty_region_pane(tty, ctx, 0, screen_size_y(s) - 1);
|
||||||
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
|
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
|
||||||
|
|
||||||
if (tty_pane_full_width(tty, ctx) && tty_term_has(tty->term, TTYC_EL)) {
|
if (tty_pane_full_width(tty, ctx) &&
|
||||||
|
tty_term_has(tty->term, TTYC_EL) && !tty_fake_bce(tty, wp)) {
|
||||||
tty_putcode(tty, TTYC_EL);
|
tty_putcode(tty, TTYC_EL);
|
||||||
if (ctx->ocy != screen_size_y(s) - 1) {
|
if (ctx->ocy != screen_size_y(s) - 1) {
|
||||||
tty_cursor_pane(tty, ctx, 0, ctx->ocy + 1);
|
tty_cursor_pane(tty, ctx, 0, ctx->ocy + 1);
|
||||||
@ -942,12 +974,13 @@ tty_cmd_clearstartofscreen(struct tty *tty, const struct tty_ctx *ctx)
|
|||||||
struct screen *s = wp->screen;
|
struct screen *s = wp->screen;
|
||||||
u_int i, j;
|
u_int i, j;
|
||||||
|
|
||||||
tty_reset(tty);
|
tty_attributes(tty, &grid_default_cell, wp);
|
||||||
|
|
||||||
tty_region_pane(tty, ctx, 0, screen_size_y(s) - 1);
|
tty_region_pane(tty, ctx, 0, screen_size_y(s) - 1);
|
||||||
tty_cursor_pane(tty, ctx, 0, 0);
|
tty_cursor_pane(tty, ctx, 0, 0);
|
||||||
|
|
||||||
if (tty_pane_full_width(tty, ctx) && tty_term_has(tty->term, TTYC_EL)) {
|
if (tty_pane_full_width(tty, ctx) &&
|
||||||
|
tty_term_has(tty->term, TTYC_EL) && !tty_fake_bce(tty, wp)) {
|
||||||
for (i = 0; i < ctx->ocy; i++) {
|
for (i = 0; i < ctx->ocy; i++) {
|
||||||
tty_putcode(tty, TTYC_EL);
|
tty_putcode(tty, TTYC_EL);
|
||||||
tty_emulate_repeat(tty, TTYC_CUD, TTYC_CUD1, 1);
|
tty_emulate_repeat(tty, TTYC_CUD, TTYC_CUD1, 1);
|
||||||
@ -969,12 +1002,13 @@ tty_cmd_clearscreen(struct tty *tty, const struct tty_ctx *ctx)
|
|||||||
struct screen *s = wp->screen;
|
struct screen *s = wp->screen;
|
||||||
u_int i, j;
|
u_int i, j;
|
||||||
|
|
||||||
tty_reset(tty);
|
tty_attributes(tty, &grid_default_cell, wp);
|
||||||
|
|
||||||
tty_region_pane(tty, ctx, 0, screen_size_y(s) - 1);
|
tty_region_pane(tty, ctx, 0, screen_size_y(s) - 1);
|
||||||
tty_cursor_pane(tty, ctx, 0, 0);
|
tty_cursor_pane(tty, ctx, 0, 0);
|
||||||
|
|
||||||
if (tty_pane_full_width(tty, ctx) && tty_term_has(tty->term, TTYC_EL)) {
|
if (tty_pane_full_width(tty, ctx) &&
|
||||||
|
tty_term_has(tty->term, TTYC_EL) && !tty_fake_bce(tty, wp)) {
|
||||||
for (i = 0; i < screen_size_y(s); i++) {
|
for (i = 0; i < screen_size_y(s); i++) {
|
||||||
tty_putcode(tty, TTYC_EL);
|
tty_putcode(tty, TTYC_EL);
|
||||||
if (i != screen_size_y(s) - 1) {
|
if (i != screen_size_y(s) - 1) {
|
||||||
@ -997,7 +1031,7 @@ tty_cmd_alignmenttest(struct tty *tty, const struct tty_ctx *ctx)
|
|||||||
struct screen *s = wp->screen;
|
struct screen *s = wp->screen;
|
||||||
u_int i, j;
|
u_int i, j;
|
||||||
|
|
||||||
tty_reset(tty);
|
tty_attributes(tty, &grid_default_cell, wp);
|
||||||
|
|
||||||
tty_region_pane(tty, ctx, 0, screen_size_y(s) - 1);
|
tty_region_pane(tty, ctx, 0, screen_size_y(s) - 1);
|
||||||
|
|
||||||
@ -1038,12 +1072,12 @@ tty_cmd_cell(struct tty *tty, const struct tty_ctx *ctx)
|
|||||||
*/
|
*/
|
||||||
cx = screen_size_x(s) - grid_cell_width(&ctx->last_cell);
|
cx = screen_size_x(s) - grid_cell_width(&ctx->last_cell);
|
||||||
tty_cursor_pane(tty, ctx, cx, ctx->ocy);
|
tty_cursor_pane(tty, ctx, cx, ctx->ocy);
|
||||||
tty_cell(tty, &ctx->last_cell);
|
tty_cell(tty, &ctx->last_cell, wp);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
|
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
|
||||||
|
|
||||||
tty_cell(tty, ctx->cell);
|
tty_cell(tty, ctx->cell, wp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1055,7 +1089,7 @@ tty_cmd_utf8character(struct tty *tty, const struct tty_ctx *ctx)
|
|||||||
* Cannot rely on not being a partial character, so just redraw the
|
* Cannot rely on not being a partial character, so just redraw the
|
||||||
* whole line.
|
* whole line.
|
||||||
*/
|
*/
|
||||||
tty_draw_line(tty, wp->screen, ctx->ocy, ctx->xoff, ctx->yoff);
|
tty_draw_pane(tty, wp, ctx->ocy, ctx->xoff, ctx->yoff);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1088,12 +1122,13 @@ tty_cmd_rawstring(struct tty *tty, const struct tty_ctx *ctx)
|
|||||||
tty->cx = tty->cy = UINT_MAX;
|
tty->cx = tty->cy = UINT_MAX;
|
||||||
tty->rupper = tty->rlower = UINT_MAX;
|
tty->rupper = tty->rlower = UINT_MAX;
|
||||||
|
|
||||||
tty_reset(tty);
|
tty_attributes(tty, &grid_default_cell, ctx->wp);
|
||||||
tty_cursor(tty, 0, 0);
|
tty_cursor(tty, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tty_cell(struct tty *tty, const struct grid_cell *gc)
|
tty_cell(struct tty *tty, const struct grid_cell *gc,
|
||||||
|
const struct window_pane *wp)
|
||||||
{
|
{
|
||||||
struct utf8_data ud;
|
struct utf8_data ud;
|
||||||
u_int i;
|
u_int i;
|
||||||
@ -1108,7 +1143,7 @@ tty_cell(struct tty *tty, const struct grid_cell *gc)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* Set the attributes. */
|
/* Set the attributes. */
|
||||||
tty_attributes(tty, gc);
|
tty_attributes(tty, gc, wp);
|
||||||
|
|
||||||
/* Get the cell and if ASCII write with putc to do ACS translation. */
|
/* Get the cell and if ASCII write with putc to do ACS translation. */
|
||||||
grid_cell_get(gc, &ud);
|
grid_cell_get(gc, &ud);
|
||||||
@ -1312,12 +1347,14 @@ out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tty_attributes(struct tty *tty, const struct grid_cell *gc)
|
tty_attributes(struct tty *tty, const struct grid_cell *gc,
|
||||||
|
const struct window_pane *wp)
|
||||||
{
|
{
|
||||||
struct grid_cell *tc = &tty->cell, gc2;
|
struct grid_cell *tc = &tty->cell, gc2;
|
||||||
u_char changed;
|
u_char changed;
|
||||||
|
|
||||||
memcpy(&gc2, gc, sizeof gc2);
|
memcpy(&gc2, gc, sizeof gc2);
|
||||||
|
tty_default_colours(&gc2, wp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If no setab, try to use the reverse attribute as a best-effort for a
|
* If no setab, try to use the reverse attribute as a best-effort for a
|
||||||
@ -1609,6 +1646,47 @@ tty_try_256(struct tty *tty, u_char colour, const char *type)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
tty_default_colours(struct grid_cell *gc, const struct window_pane *wp)
|
||||||
|
{
|
||||||
|
const struct grid_cell *agc, *pgc, *wgc;
|
||||||
|
|
||||||
|
if (wp == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
pgc = &wp->colgc;
|
||||||
|
agc = options_get_style(&wp->window->options, "window-active-style");
|
||||||
|
wgc = options_get_style(&wp->window->options, "window-style");
|
||||||
|
|
||||||
|
if (gc->fg == 8 && !(gc->flags & GRID_FLAG_FG256)) {
|
||||||
|
if (pgc->fg != 8 || (pgc->flags & GRID_FLAG_FG256)) {
|
||||||
|
gc->fg = pgc->fg;
|
||||||
|
gc->flags |= (pgc->flags & GRID_FLAG_FG256);
|
||||||
|
} else if (wp == wp->window->active &&
|
||||||
|
(agc->fg != 8 || (agc->flags & GRID_FLAG_FG256))) {
|
||||||
|
gc->fg = agc->fg;
|
||||||
|
gc->flags |= (agc->flags & GRID_FLAG_FG256);
|
||||||
|
} else {
|
||||||
|
gc->fg = wgc->fg;
|
||||||
|
gc->flags |= (wgc->flags & GRID_FLAG_FG256);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gc->bg == 8 && !(gc->flags & GRID_FLAG_BG256)) {
|
||||||
|
if (pgc->bg != 8 || (pgc->flags & GRID_FLAG_BG256)) {
|
||||||
|
gc->bg = pgc->bg;
|
||||||
|
gc->flags |= (pgc->flags & GRID_FLAG_BG256);
|
||||||
|
} else if (wp == wp->window->active &&
|
||||||
|
(agc->bg != 8 || (agc->flags & GRID_FLAG_BG256))) {
|
||||||
|
gc->bg = agc->bg;
|
||||||
|
gc->flags |= (agc->flags & GRID_FLAG_BG256);
|
||||||
|
} else {
|
||||||
|
gc->bg = wgc->bg;
|
||||||
|
gc->flags |= (wgc->flags & GRID_FLAG_BG256);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tty_bell(struct tty *tty)
|
tty_bell(struct tty *tty)
|
||||||
{
|
{
|
||||||
|
2
window.c
2
window.c
@ -705,6 +705,8 @@ window_pane_create(struct window *w, u_int sx, u_int sy, u_int hlimit)
|
|||||||
|
|
||||||
wp->saved_grid = NULL;
|
wp->saved_grid = NULL;
|
||||||
|
|
||||||
|
memcpy(&wp->colgc, &grid_default_cell, sizeof wp->colgc);
|
||||||
|
|
||||||
screen_init(&wp->base, sx, sy, hlimit);
|
screen_init(&wp->base, sx, sy, hlimit);
|
||||||
wp->screen = &wp->base;
|
wp->screen = &wp->base;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user