]> git.ipfire.org Git - thirdparty/util-linux.git/commit
libsmartcols: avoid cumulative width reduction during printing
authorAlessandro Ratti <alessandro@0x65c.net>
Sun, 28 Dec 2025 18:07:55 +0000 (19:07 +0100)
committerAlessandro Ratti <alessandro@0x65c.net>
Wed, 7 Jan 2026 13:29:14 +0000 (14:29 +0100)
commit504456effff6740d89eb6735b4eba33e54aca3ad
treeac7ef347cba9b2a104f562e8982e0c274a42951d
parent8ec679cfb0507fa0f772d7108466964e18e00af9
libsmartcols: avoid cumulative width reduction during printing

__scols_initialize_printing() applied scols_table_reduce_termwidth()
by mutating table->termwidth via scols_table_set_termwidth().

When printing is performed repeatedly on the same table (e.g. in
interactive applications), this causes the effective output width
to shrink on each invocation, eventually truncating output.

Introduce an internally computed effective output width and stop
modifying termwidth during printing. All layout calculations are
updated to use the derived width instead, making the printing path
idempotent.

No functional change is expected for single-shot printing.

Addresses: https://github.com/util-linux/util-linux/issues/3895
Suggested-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Alessandro Ratti <alessandro@0x65c.net>
libsmartcols/src/calculate.c
libsmartcols/src/print.c
libsmartcols/src/smartcolsP.h