diff options
author | james <> | 2008-02-04 02:05:06 +0000 |
---|---|---|
committer | james <> | 2008-02-04 02:05:06 +0000 |
commit | c4b7eff58a98590defd94bdbd39a7798521b55a1 (patch) | |
tree | 283863d2eeac8e8a79142e16c37e31dca38f43fb /src/ansi.c | |
parent | e45109d0e28411913f65e5aa16911e19217d2312 (diff) | |
download | sympathy-c4b7eff58a98590defd94bdbd39a7798521b55a1.tar.gz sympathy-c4b7eff58a98590defd94bdbd39a7798521b55a1.tar.bz2 sympathy-c4b7eff58a98590defd94bdbd39a7798521b55a1.zip |
*** empty log message ***
Diffstat (limited to 'src/ansi.c')
-rw-r--r-- | src/ansi.c | 82 |
1 files changed, 44 insertions, 38 deletions
@@ -10,10 +10,14 @@ static char rcsid[] = "$Id$"; /* * $Log$ + * Revision 1.2 2008/02/04 02:05:06 james + * *** empty log message *** + * * Revision 1.1 2008/02/03 23:31:25 james * *** empty log message *** * */ +#include "project.h" void ansi_write (ANSI * a, char *buf, int n) @@ -131,60 +135,62 @@ ansi_showhide_cursor (ANSI * a, int hide) } -void ansi_force_attr_normal(ANSI *a) +void +ansi_force_attr_normal (ANSI * a) { ansi_write (a, "\033[0m", 4); - a->attr=CRT_ATTR_NORMAL; + a->attr = CRT_ATTR_NORMAL; } void ansi_set_attr (ANSI * a, int attr) { + int dif; dif = attr ^ a->attr; if (!dif) return; - if (attr == ATTR_NORMAL) + if (attr == CRT_ATTR_NORMAL) { - ansi_force_attr_normal(a); - return; + ansi_force_attr_normal (a); + return; } - if (dif & CRT_ATTR_UNDERLINE) + if (dif & CRT_ATTR_UNDERLINE) + { + if (attr & CRT_ATTR_UNDERLINE) { - if (attr & CRT_ATTR_UNDERLINE) - { - ansi_write (a, "\033[4m", 4); - } - else - { - ansi_write (a, "\033[24m", 5); - } + ansi_write (a, "\033[4m", 4); } - if (dif & CRT_ATTR_REVERSE) + else { - if (attr & CRT_ATTR_REVERSE) - { - ansi_write (a, "\033[7m", 4); - } - else - { - ansi_write (a, "\033[27m", 5); - } + ansi_write (a, "\033[24m", 5); + } + } + if (dif & CRT_ATTR_REVERSE) + { + if (attr & CRT_ATTR_REVERSE) + { + ansi_write (a, "\033[7m", 4); } - if (dif & CRT_ATTR_BOLD) + else { - if (attr & CRT_ATTR_REVERSE) - { - ansi_write (a, "\033[1m", 4); - } - else - { - ansi_write (a, "\033[22m", 5); - } + ansi_write (a, "\033[27m", 5); } + } + if (dif & CRT_ATTR_BOLD) + { + if (attr & CRT_ATTR_REVERSE) + { + ansi_write (a, "\033[1m", 4); + } + else + { + ansi_write (a, "\033[22m", 5); + } + } } @@ -218,7 +224,7 @@ ansi_cls (ANSI * a) CRT_Pos p = { 0 }; crt_cls (&a->crt); - ansi_force_attr_normal(a); + ansi_force_attr_normal (a); ansi_move (a, p); ansi_write (a, "\033[2J", 4); /*different emulators leave cursor in different places after cls differently*/ @@ -238,17 +244,17 @@ ansi_draw (ANSI * a, CRT * c) { if (p.y >= a->size.y) continue; - o = CRT_ADDR (r, 0); + o = CRT_ADDR (p.y, 0); for (p.x = 0; p.x < CRT_COLS; ++p.x, ++o) { if (p.x >= a->size.x) continue; - if (crt_ca_cmp (a->crt.screen[p], c->screen[p])) + if (crt_ca_cmp (a->crt.screen[o], c->screen[o])) { - a->crt.screen[p] = c->screen[p]; + a->crt.screen[o] = c->screen[o]; ansi_move (a, p); - ansi_render (a, a->crt.screen[p]); + ansi_render (a, a->crt.screen[o]); } } } @@ -257,7 +263,7 @@ ansi_draw (ANSI * a, CRT * c) ansi_move (a, a->crt.pos); a->crt.hide_cursor = c->hide_cursor; - ansi_showhide_cursor (a, ci->crt.hide_cursor); + ansi_showhide_cursor (a, a->crt.hide_cursor); } void |