summaryrefslogtreecommitdiffstats
path: root/screen-redraw.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2010-09-11 16:19:22 +0000
committerNicholas Marriott <nicm@openbsd.org>2010-09-11 16:19:22 +0000
commitcb564bb427b9db5b1e48a74e6b818454f7ab0c77 (patch)
treecb4192419ba33d2161c045a3d68ef24758d9d083 /screen-redraw.c
parent3696cce4ae83e27ac757bceaad6a0c9fa27525d4 (diff)
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.
Diffstat (limited to 'screen-redraw.c')
-rw-r--r--screen-redraw.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/screen-redraw.c b/screen-redraw.c
index bd3010cb..2024e675 100644
--- a/screen-redraw.c
+++ b/screen-redraw.c
@@ -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]);
}
}