X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=inject_csi.c;h=e2b6430a28ce8a3cf481674aa590e24416f5536f;hb=7ea77f37c3d2ad6f176182e2b1441dd33e39af8c;hp=2d3ba6506b8ca6820b1ef9bf3519937584c7dc4b;hpb=93c516d8991c4b6935fc03a24317ea0785e78a93;p=apps%2Fmadtty.git diff --git a/inject_csi.c b/inject_csi.c index 2d3ba65..e2b6430 100644 --- a/inject_csi.c +++ b/inject_csi.c @@ -1,3 +1,24 @@ +/* +LICENSE INFORMATION: +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License (LGPL) as published by the Free Software Foundation. + +Please refer to the COPYING file for more information. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Copyright (c) 2004 Bruno T. C. de Oliveira +*/ + + #include "inject_csi.h" #include "roteprivate.h" #include @@ -27,11 +48,46 @@ 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 */ - else if (param[i] == 7) rt->curattr = 0x07; /* reverse video */ + 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 || param[i] == 27) { /* reverse video */ + int fg = ROTE_ATTR_FG(rt->curattr); + int bg = ROTE_ATTR_BG(rt->curattr); + ROTE_ATTR_MOD_FG(rt->curattr, bg); + ROTE_ATTR_MOD_BG(rt->curattr, fg); + } + 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] == 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 */