From f47ab8f13fd76cb1761c74d1384ce7695ebbea44 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Tue, 27 Nov 2007 23:01:27 +0000 Subject: [PATCH] Don't nuke charset flag on [0m. Also rename DRAWING -> CHARSET flag. --- TODO | 1 + input.c | 8 ++++---- tmux.h | 4 ++-- tty.c | 8 ++++---- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/TODO b/TODO index 06e915ed..e9a52a23 100644 --- a/TODO +++ b/TODO @@ -57,6 +57,7 @@ - lift SHRT_MAX limits for history - audit copy/scroll and other modes for problems with very small windows - screen_draw_* moved out/renamed (accept TTY_*?) +- get rid of stderr/stdout hacks in log.c -- For 0.2 -------------------------------------------------------------------- - window splitting? diff --git a/input.c b/input.c index c447b40b..90d41785 100644 --- a/input.c +++ b/input.c @@ -1,4 +1,4 @@ -/* $Id: input.c,v 1.40 2007-11-27 22:12:14 nicm Exp $ */ +/* $Id: input.c,v 1.41 2007-11-27 23:01:27 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -432,11 +432,11 @@ input_handle_c0_control(u_char ch, struct input_ctx *ictx) input_write(ictx, TTY_CURSORMOVE, s->cy, s->cx); return; case '\016': /* SO */ - s->attr |= ATTR_DRAWING; + s->attr |= ATTR_CHARSET; input_write(ictx, TTY_ATTRIBUTES, s->attr, s->colr); return; case '\017': /* SI */ - s->attr &= ~ATTR_DRAWING; + s->attr &= ~ATTR_CHARSET; input_write(ictx, TTY_ATTRIBUTES, s->attr, s->colr); return; default: @@ -1057,7 +1057,7 @@ input_handle_sequence_sgr(struct input_ctx *ictx) switch (m) { case 0: case 10: - s->attr = 0; + s->attr &= ATTR_CHARSET; s->colr = SCREEN_DEFCOLR; break; case 1: diff --git a/tmux.h b/tmux.h index e45c3e41..0c77c392 100644 --- a/tmux.h +++ b/tmux.h @@ -1,4 +1,4 @@ -/* $Id: tmux.h,v 1.104 2007-11-27 20:03:08 nicm Exp $ */ +/* $Id: tmux.h,v 1.105 2007-11-27 23:01:27 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -332,7 +332,7 @@ struct msg_resize_data { #define ATTR_REVERSE 0x10 #define ATTR_HIDDEN 0x20 #define ATTR_ITALICS 0x40 -#define ATTR_DRAWING 0x80 /* line drawing character set */ +#define ATTR_CHARSET 0x80 /* alternative character set */ /* Modes. */ #define MODE_CURSOR 0x001 diff --git a/tty.c b/tty.c index 71a8c616..c3e8850e 100644 --- a/tty.c +++ b/tty.c @@ -1,4 +1,4 @@ -/* $Id: tty.c,v 1.5 2007-11-27 21:07:38 nicm Exp $ */ +/* $Id: tty.c,v 1.6 2007-11-27 23:01:27 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -201,7 +201,7 @@ tty_puts(struct tty *tty, const char *s) void tty_putc(struct tty *tty, char ch) { - if (tty->attr & ATTR_DRAWING) + if (tty->attr & ATTR_CHARSET) ch = tty_get_acs(tty, ch); buffer_write8(tty->out, ch); } @@ -346,7 +346,7 @@ tty_attributes(struct tty *tty, u_char attr, u_char colr) /* If any bits are being cleared, reset everything. */ if (tty->attr & ~attr) { - if ((tty->attr & ATTR_DRAWING) && + if ((tty->attr & ATTR_CHARSET) && exit_alt_charset_mode != NULL) tty_puts(tty, exit_alt_charset_mode); tty_puts(tty, exit_attribute_mode); @@ -372,7 +372,7 @@ tty_attributes(struct tty *tty, u_char attr, u_char colr) tty_puts(tty, enter_reverse_mode); if ((attr & ATTR_HIDDEN) && enter_secure_mode != NULL) tty_puts(tty, enter_secure_mode); - if ((attr & ATTR_DRAWING) && enter_alt_charset_mode != NULL) + if ((attr & ATTR_CHARSET) && enter_alt_charset_mode != NULL) tty_puts(tty, enter_alt_charset_mode); fg = (colr >> 4) & 0xf;