Don't nuke charset flag on [0m. Also rename DRAWING -> CHARSET flag.

This commit is contained in:
Nicholas Marriott 2007-11-27 23:01:27 +00:00
parent 43c99c2fab
commit f47ab8f13f
4 changed files with 11 additions and 10 deletions

1
TODO
View File

@ -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?

View File

@ -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 <nicm@users.sourceforge.net>
@ -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:

4
tmux.h
View File

@ -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 <nicm@users.sourceforge.net>
@ -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

8
tty.c
View File

@ -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 <nicm@users.sourceforge.net>
@ -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;