* @sep: separator
*
* Sets the column separator of @tb to @sep.
- * Please note that @sep should always take up a single cell in the output.
*
* Returns: 0, a negative value in case of an error.
*/
size_t width = 0, width_min = 0; /* output width */
int trunc_only, rc = 0;
int extremes = 0;
+ size_t colsepsz;
DBG(TAB, ul_debugobj(tb, "recounting widths (termwidth=%zu)", tb->termwidth));
+ colsepsz = mbs_safe_width(colsep(tb));
+
/* set basic columns width
*/
scols_reset_iter(&itr, SCOLS_ITER_FORWARD);
is_last = is_last_column(cl);
- width += cl->width + (is_last ? 0 : 1); /* separator for non-last column */
- width_min += cl->width_min + (is_last ? 0 : 1);
+ width += cl->width + (is_last ? 0 : colsepsz); /* separator for non-last column */
+ width_min += cl->width_min + (is_last ? 0 : colsepsz);
extremes += cl->is_extreme;
}
width -= r;
} else {
cl->flags |= SCOLS_FL_HIDDEN;
- width -= cl->width + 1; /* +1 means separator between columns */
+ width -= cl->width + colsepsz;
}
}
}