From 77ae017377c79e4286da2fbddc1d88472b698916 Mon Sep 17 00:00:00 2001 From: anjakefala Date: Sat, 6 May 2023 20:49:57 -0700 Subject: [PATCH] [fixed] use maxWidth for saving if larger than column width Closes #1849 --- visidata/loaders/fixed_width.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/visidata/loaders/fixed_width.py b/visidata/loaders/fixed_width.py index 5e78f0ae8..684b644c9 100644 --- a/visidata/loaders/fixed_width.py +++ b/visidata/loaders/fixed_width.py @@ -84,7 +84,8 @@ def save_fixed(vd, p, *vsheets): widths = {} # Column -> width:int # headers for col in Progress(sheet.visibleCols, gerund='sizing'): - widths[col] = col.width or sheet.options.default_width or col.getMaxWidth(sheet.rows) + maxWidth = col.getMaxWidth(sheet.rows) + widths[col] = col.width if col.width >= maxWidth else sheet.options.default_width or maxWidth fp.write(('{0:%s} ' % widths[col]).format(col.name)) fp.write('\n')