summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-10-18 02:37:02 -0400
committerJesse Luehrs <doy@tozt.net>2014-10-18 02:37:02 -0400
commit465ad8a7789556fafb4378b5da4bc988eabde479 (patch)
tree3ee6482e3261b6bd0b4ac29f96e9fbf1165fe3ae
parent481669067f721a6aebc1009f047509fbb04b6811 (diff)
downloadlibvt100-465ad8a7789556fafb4378b5da4bc988eabde479.tar.gz
libvt100-465ad8a7789556fafb4378b5da4bc988eabde479.zip
don't add an extra space after wide characters
-rw-r--r--src/screen.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/screen.c b/src/screen.c
index 4abbbdc..4cec9a2 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -802,7 +802,7 @@ static void vt100_screen_get_string(
*strp = malloc(capacity);
for (row = start->row; row <= end->row; ++row) {
- int start_col, end_col, max_col;
+ int start_col, end_col, max_col, was_wide = 0;
struct vt100_row *grid_row = &vt->grid->rows[row];
max_col = vt100_screen_row_max_col(vt, row);
@@ -906,12 +906,16 @@ static void vt100_screen_get_string(
memcpy(&attrs, &cell->attrs, sizeof(struct vt100_cell_attrs));
}
- if (cell->len == 0) {
- contents = " ";
- len = 1;
+ if (!was_wide) {
+ if (cell->len == 0) {
+ contents = " ";
+ len = 1;
+ }
+
+ vt100_screen_push_string(strp, lenp, &capacity, contents, len);
}
- vt100_screen_push_string(strp, lenp, &capacity, contents, len);
+ was_wide = cell->is_wide;
}
if ((row != end->row || end->col > max_col) && !grid_row->wrapped) {