mirror of
https://github.com/tmux/tmux.git
synced 2025-09-02 21:56:57 +00:00
Use UTF-8 line drawing characters on UTF-8 terminals. Fixes some stupid
terminals (I'm looking at you, putty) which disable the vt100 ACS mode switching sequences in UTF-8 mode. Also on terminals without ACS at all, use ASCII equivalents where obvious.
This commit is contained in:
@ -41,6 +41,8 @@ void screen_redraw_draw_number(struct client *, struct window_pane *);
|
||||
#define CELL_JOIN 11
|
||||
#define CELL_OUTSIDE 12
|
||||
|
||||
#define CELL_BORDERS " xqlkmjwvtun~"
|
||||
|
||||
/* Check if cell is on the border of a particular pane. */
|
||||
int
|
||||
screen_redraw_cell_border1(struct window_pane *wp, u_int px, u_int py)
|
||||
@ -173,8 +175,6 @@ screen_redraw_screen(struct client *c, int status_only, int borders_only)
|
||||
struct grid_cell active_gc, other_gc;
|
||||
u_int i, j, type;
|
||||
int status, fg, bg;
|
||||
const u_char *base, *ptr;
|
||||
u_char ch, border[20];
|
||||
|
||||
/* Get status line, er, status. */
|
||||
if (c->message_string != NULL || c->prompt_string != NULL)
|
||||
@ -193,6 +193,7 @@ screen_redraw_screen(struct client *c, int status_only, int borders_only)
|
||||
memcpy(&other_gc, &grid_default_cell, sizeof other_gc);
|
||||
memcpy(&active_gc, &grid_default_cell, sizeof active_gc);
|
||||
active_gc.data = other_gc.data = 'x'; /* not space */
|
||||
active_gc.attr = other_gc.attr = GRID_ATTR_CHARSET;
|
||||
fg = options_get_number(&c->session->options, "pane-border-fg");
|
||||
colour_set_fg(&other_gc, fg);
|
||||
bg = options_get_number(&c->session->options, "pane-border-bg");
|
||||
@ -203,16 +204,6 @@ screen_redraw_screen(struct client *c, int status_only, int borders_only)
|
||||
colour_set_bg(&active_gc, bg);
|
||||
|
||||
/* Draw background and borders. */
|
||||
strlcpy(border, " |-....--||+.", sizeof border);
|
||||
if (tty_term_has(tty->term, TTYC_ACSC)) {
|
||||
base = " xqlkmjwvtun~";
|
||||
for (ptr = base; *ptr != '\0'; ptr++) {
|
||||
if ((ch = tty_get_acs(tty, *ptr)) != '\0')
|
||||
border[ptr - base] = ch;
|
||||
}
|
||||
other_gc.attr |= GRID_ATTR_CHARSET;
|
||||
active_gc.attr |= GRID_ATTR_CHARSET;
|
||||
}
|
||||
for (j = 0; j < tty->sy - status; j++) {
|
||||
if (status_only && j != tty->sy - 1)
|
||||
continue;
|
||||
@ -225,7 +216,7 @@ screen_redraw_screen(struct client *c, int status_only, int borders_only)
|
||||
else
|
||||
tty_attributes(tty, &other_gc);
|
||||
tty_cursor(tty, i, j);
|
||||
tty_putc(tty, border[type]);
|
||||
tty_putc(tty, CELL_BORDERS[type]);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user