From: btakahashi Date: Mon, 9 May 2005 13:23:57 +0000 (+0000) Subject: Applied Phil Endecott's patch, which adds support for additional SGR X-Git-Url: http://git.madism.org/?a=commitdiff_plain;ds=inline;h=57358ec0b92d3529774187a4176c0e8a422eaf1b;p=apps%2Fmadtty.git Applied Phil Endecott's patch, which adds support for additional SGR escape sequences and fixes a few bugs -- "top" now works because the cursor will remain on the same line after outputting a full line of text, instead of jumping to the next line as it was doing before. Phil Endocott's email: phil_achbq_endecott@chezphil.org --- diff --git a/README b/README index 7563eac..94d87ce 100644 --- a/README +++ b/README @@ -10,6 +10,10 @@ The project home page is: http://rote.sourceforge.net +[[ OTHER PEOPLE INVOLVED IN DEVELOPING THIS LIBRARY ]] + +* Phil Endecott (phil_achbq_endecott@chezphil.org) + [[ WHAT IS IT? ]] ROTE is a simple C library for VT102 terminal emulation. It allows the diff --git a/configure.ac b/configure.ac index 91fd994..8070a62 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT([rote], 0.2.6) +AC_INIT([rote], 0.2.7) AC_SUBST(PACKAGE_NAME) AC_SUBST(PACKAGE_VERSION) diff --git a/inject.c b/inject.c index 9d3c431..f9f40e8 100644 --- a/inject.c +++ b/inject.c @@ -75,17 +75,17 @@ static void cursor_line_up(RoteTerm *rt) { } static inline void put_normal_char(RoteTerm *rt, char c) { + if (rt->ccol >= rt->cols) { + rt->ccol = 0; + cursor_line_down(rt); + } + rt->cells[rt->crow][rt->ccol].ch = c; rt->cells[rt->crow][rt->ccol].attr = rt->curattr; rt->ccol++; rt->line_dirty[rt->crow] = true; rt->curpos_dirty = true; - - if (rt->ccol >= rt->cols) { - rt->ccol = 0; - cursor_line_down(rt); - } } static inline void put_graphmode_char(RoteTerm *rt, char c) { diff --git a/inject_csi.c b/inject_csi.c index 8d5ee9d..e7652aa 100644 --- a/inject_csi.c +++ b/inject_csi.c @@ -48,11 +48,43 @@ static void interpret_csi_SGR(RoteTerm *rt, int param[], int pcount) { } for (i = 0; i < pcount; i++) { + +// From http://vt100.net/docs/vt510-rm/SGR table 5-16 +// 0 All attributes off +// 1 Bold +// 4 Underline +// 5 Blinking +// 7 Negative image +// 8 Invisible image +// 10 The ASCII character set is the current 7-bit +// display character set (default) - SCO Console only. +// 11 Map Hex 00-7F of the PC character set codes +// to the current 7-bit display character set +// - SCO Console only. +// 12 Map Hex 80-FF of the current character set to +// the current 7-bit display character set - SCO +// Console only. +// 22 Bold off +// 24 Underline off +// 25 Blinking off +// 27 Negative image off +// 28 Invisible image off + if (param[i] == 0) rt->curattr = 0x70; else if (param[i] == 1 || param[i] == 2 || param[i] == 4) /* set bold */ - rt->curattr |= 0x80; - else if (param[i] == 5) rt->curattr |= 0x08; /* set blink */ + ROTE_ATTR_MOD_BOLD(rt->curattr,1); + else if (param[i] == 5) /* set blink */ + ROTE_ATTR_MOD_BLINK(rt->curattr,1); else if (param[i] == 7) rt->curattr = 0x07; /* reverse video */ + else if (param[i] == 8) rt->curattr = 0x0; /* invisible */ + else if (param[i] == 22 || param[i] == 24) /* bold off */ + ROTE_ATTR_MOD_BOLD(rt->curattr,0); + else if (param[i] == 25) /* blink off */ + ROTE_ATTR_MOD_BLINK(rt->curattr,0); + else if (param[i] == 27) /* negative off */ + rt->curattr = 0x70; + else if (param[i] == 28) /* invisible off */ + rt->curattr = 0x70; else if (param[i] >= 30 && param[i] <= 37) /* set fg */ ROTE_ATTR_MOD_FG(rt->curattr, param[i] - 30); else if (param[i] >= 40 && param[i] <= 47) /* set bg */ diff --git a/rote.h b/rote.h index 6e4742b..a4f6b3e 100644 --- a/rote.h +++ b/rote.h @@ -79,7 +79,7 @@ Copyright (c) 2004 Bruno T. C. de Oliveira #define ROTE_ATTR_MOD_BOLD(attr, boldbit) \ attr &= 0x7F, attr |= (boldbit)?0x80:0x00 #define ROTE_ATTR_MOD_BLINK(attr, blinkbit) \ - attr &= 0xF7, attr |= (boldbit)?0x08:0x00 + attr &= 0xF7, attr |= (blinkbit)?0x08:0x00 /* these return non-zero for 'yes', zero for 'no'. Don't rely on them being * any more specific than that (e.g. being exactly 1 for 'yes' or whatever). */