From 89fd3b76518cf3004053331c580a349afaaf2dab Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sun, 29 Oct 2006 08:07:51 +0000 Subject: major internal changes in representation of character cells. we now use 12 bytes per cell instead of 10. however, this allows us to support 256-color mode (not yet implemented but the framework is in place) and to mix scripts when using combining characters. while the latter sounds ridiculous at first, being able to visibly see a combining letter attached to a [, ", or ' is extremely useful in scripting and regular expressions with some languages. some code is left slightly messy, but overall it's much cleaner now since struct uucell is now properly encapsulated. --- refresh.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'refresh.c') diff --git a/refresh.c b/refresh.c index 9e3ab57..06e6f69 100644 --- a/refresh.c +++ b/refresh.c @@ -7,16 +7,17 @@ static void extract_cell(unsigned *ch, size_t max, struct uucell *cell) { - int i, l; - unsigned b; - for (b=i=0; i<3; i++) b |= cell->c[i] << 8*i; - l = uu_decompose_char(b, ch, max); - ch += l; max -= l; - for (; ic) && cell->c[i]; i++) { - l = uu_decompose_char(uu_combine_involution(b, cell->c[i]), ch, max); + int i, j, l; + wchar_t ws[8]; + int attr = uucell_get_attr(cell); + + uucell_get_wcs(cell, ws, 8); + + for (i=j=0; ws[i]; i++) { + l = uu_decompose_char(ws[i], ch, max); ch += l; max -= l; } - if ((cell->a & UU_ATTR_UL) && max) + if ((attr & UU_ATTR_UL) && max) max--, *ch++ = '_'; //0x0332; for (; max; max--) *ch++ = 0; ch[-1] = 0; @@ -54,7 +55,7 @@ void uuterm_refresh_row(struct uudisp *d, struct uurow *row, int x1, int x2) } else { width = 1; part = 0; chp = ch[x&3]; } - uudisp_predraw_cell(d, row->idx, x, row->cells[x].a & 0xff); + uudisp_predraw_cell(d, row->idx, x, uucell_get_color(&row->cells[x])); for (i=0; ifont, i, chp, ch[(x+3)&3], ch[(x+1)&3], width, part); if (glyph) uudisp_draw_glyph(d, row->idx, x, glyph); -- cgit v1.2.3