On a Friday in 2026, Peter Krempa via Devel wrote:
From: Peter Krempa <[email protected]>


In the summary, s/lenght/length/

Modify the array holding lenghts of individual colums in the table to

lengths
columns

include the spacing. This will be used later when we'll allow to modify
the spacing.

To do this we'll include the 3 extra spaces as lenghths as well as fix

lengths

the two loops using the value to use it directly.

Since the spacing is not included in the string the code in
'vshTableRowPrint' is modified to explicitly add the spacing instead of
adding a constant to the calculated length.

Signed-off-by: Peter Krempa <[email protected]>
---
tools/vsh-table.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/tools/vsh-table.c b/tools/vsh-table.c
index 0c96407f03..0e537dd106 100644
--- a/tools/vsh-table.c
+++ b/tools/vsh-table.c
@@ -257,7 +257,8 @@ vshTableSafeEncode(const char *s, size_t *width)
 *
 * Fill passed @maxwidths and @widths arrays with maximum number
 * of characters for columns and number of character per each
- * table cell, respectively.
+ * table cell, respectively. Both lengths include the extra whitespace for
+ * separation of colums.

columns

 * Handle unicode strings (user must have multibyte locale)
 *
 * Return 0 in case of success, -1 otherwise.

Reviewed-by: Ján Tomko <[email protected]>

Jano

Attachment: signature.asc
Description: PGP signature

Reply via email to