From e434549a4d123e8cdbc61669b0a586dabf455fce Mon Sep 17 00:00:00 2001 From: Ben Wiley Sittler Date: Tue, 4 Nov 2008 05:45:21 +0000 Subject: [PATCH] force a column alignment after each column containing a fullwidth character. --- caca/codec/export.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/caca/codec/export.c b/caca/codec/export.c index f375d9c..f1b6377 100644 --- a/caca/codec/export.c +++ b/caca/codec/export.c @@ -503,6 +503,7 @@ static void *export_html3(caca_canvas_t const *cv, size_t *bytes) for(y = 0; y < cv->height; y++) { uint32_t *lineattr = cv->attrs + y * cv->width; + uint32_t *linechar = cv->chars + y * cv->width; for(x = 1; x < cv->width; x++) if((! (cell_boundary_bitmap @@ -511,7 +512,9 @@ static void *export_html3(caca_canvas_t const *cv, size_t *bytes) : has_multi_cell_row)) && - ((caca_attr_to_ansi_bg(lineattr[x - 1]) + ((linechar[x - 1] == CACA_MAGIC_FULLWIDTH) + || + (caca_attr_to_ansi_bg(lineattr[x - 1]) != caca_attr_to_ansi_bg(lineattr[x])) || @@ -569,6 +572,8 @@ static void *export_html3(caca_canvas_t const *cv, size_t *bytes) || (cv->height == 1)) && + (linechar[x + len - 1] != CACA_MAGIC_FULLWIDTH) + && (caca_attr_to_ansi_bg(lineattr[x + len]) == caca_attr_to_ansi_bg(lineattr[x]))