From: Karel Zak Date: Thu, 13 Oct 2022 09:56:20 +0000 (+0200) Subject: libsmartcols: truncate by one char X-Git-Tag: v2.39-rc1~459 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3949a48dd1351cea7c523fe97666190359247630;p=thirdparty%2Futil-linux.git libsmartcols: truncate by one char Signed-off-by: Karel Zak --- diff --git a/libsmartcols/src/calculate.c b/libsmartcols/src/calculate.c index b500d33945..cb1a3c5fd7 100644 --- a/libsmartcols/src/calculate.c +++ b/libsmartcols/src/calculate.c @@ -482,9 +482,6 @@ int __scols_calculate(struct libscols_table *tb, struct ul_buffer *buf) if (cl->width == 0) continue; - if (cl->wstat.width_deviation / 2 > 1.0) - reduce = (size_t) cl->wstat.width_deviation; - trunc_flag = scols_column_is_trunc(cl) || (scols_column_is_wrap(cl) && !scols_column_is_customwrap(cl)); @@ -498,7 +495,7 @@ int __scols_calculate(struct libscols_table *tb, struct ul_buffer *buf) if (cl->width < (size_t) (cl->width_hint * tb->termwidth)) /* ignore: smaller than expected width */ break; - DBG(TAB, ul_debugobj(tb, " reducing (relative with flag)")); + DBG(TAB, ul_debugobj(tb, " reducing -%zu (relative with flag)", reduce)); cl->width -= reduce; width -= reduce; break; @@ -508,7 +505,7 @@ int __scols_calculate(struct libscols_table *tb, struct ul_buffer *buf) if (!trunc_flag) /* ignore: missing flag */ break; - DBG(TAB, ul_debugobj(tb, " reducing (all with flag)")); + DBG(TAB, ul_debugobj(tb, " reducing -%zu (all with flag)", reduce)); cl->width -= reduce; width -= reduce; break; @@ -518,7 +515,7 @@ int __scols_calculate(struct libscols_table *tb, struct ul_buffer *buf) if (cl->width_hint <= 0 || cl->width_hint >= 1) /* ignore: no relative */ break; - DBG(TAB, ul_debugobj(tb, " reducing (relative without flag)")); + DBG(TAB, ul_debugobj(tb, " reducing -%zu (relative without flag)", reduce)); cl->width -= reduce; width -= reduce; break;