summaryrefslogtreecommitdiffstats
path: root/libsmartcols
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-14 19:22:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-14 19:22:58 +0000
commit764402d8b945f7abbfa5f68a6d16c94c635f7ffe (patch)
treef04a9feedef2357ee3aa9b9eef439447f76f14c3 /libsmartcols
parentAdding debian version 2.40-8. (diff)
downloadutil-linux-764402d8b945f7abbfa5f68a6d16c94c635f7ffe.tar.xz
util-linux-764402d8b945f7abbfa5f68a6d16c94c635f7ffe.zip
Merging upstream version 2.40.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libsmartcols')
-rw-r--r--libsmartcols/docs/version.xml2
-rw-r--r--libsmartcols/scols-filter.56
-rw-r--r--libsmartcols/scols-filter.5.adoc2
-rw-r--r--libsmartcols/src/calculate.c18
-rw-r--r--libsmartcols/src/column.c2
-rw-r--r--libsmartcols/src/print.c20
6 files changed, 32 insertions, 18 deletions
diff --git a/libsmartcols/docs/version.xml b/libsmartcols/docs/version.xml
index 4bdd32f..0e1a032 100644
--- a/libsmartcols/docs/version.xml
+++ b/libsmartcols/docs/version.xml
@@ -1 +1 @@
-2.40
+2.40.1
diff --git a/libsmartcols/scols-filter.5 b/libsmartcols/scols-filter.5
index b7cb826..34dce98 100644
--- a/libsmartcols/scols-filter.5
+++ b/libsmartcols/scols-filter.5
@@ -2,12 +2,12 @@
.\" Title: scols-filter
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.20
-.\" Date: 2024-03-20
+.\" Date: 2024-05-06
.\" Manual: File formats and conventions
-.\" Source: util-linux 2.40
+.\" Source: util-linux 2.40.1
.\" Language: English
.\"
-.TH "SCOLS\-FILTER" "5" "2024-03-20" "util\-linux 2.40" "File formats and conventions"
+.TH "SCOLS\-FILTER" "5" "2024-05-06" "util\-linux 2.40.1" "File formats and conventions"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
diff --git a/libsmartcols/scols-filter.5.adoc b/libsmartcols/scols-filter.5.adoc
index ec1d95c..1cb39d0 100644
--- a/libsmartcols/scols-filter.5.adoc
+++ b/libsmartcols/scols-filter.5.adoc
@@ -2,7 +2,7 @@
////
Copyright (C) 2023 Karel Zak <kzak@redhat.com>
-This file may be copied under the terms of the GNU Public License.
+This file may be copied under the terms of the GNU General Public License.
////
= scols-filter(5)
:doctype: manpage
diff --git a/libsmartcols/src/calculate.c b/libsmartcols/src/calculate.c
index 84198da..86e1b27 100644
--- a/libsmartcols/src/calculate.c
+++ b/libsmartcols/src/calculate.c
@@ -379,9 +379,14 @@ static int reduce_column(struct libscols_table *tb,
/* columns are reduced in "bad first" way, be more
* agresive for the the worst column */
reduce = 3;
- if (cl->width - reduce < st->width_min)
- reduce = cl->width - st->width_min;
- cl->width -= reduce;
+
+ if (cl->width < reduce)
+ reduce = cl->width;
+
+ if (cl->width - reduce > st->width_min)
+ cl->width -= reduce;
+ else
+ cl->width = st->width_min;
break;
default:
return -1; /* no more stages */
@@ -413,10 +418,8 @@ int __scols_calculate(struct libscols_table *tb, struct ul_buffer *buf)
size_t colsepsz;
int sorted = 0;
-
DBG(TAB, ul_debugobj(tb, "-----calculate-(termwidth=%zu)-----", tb->termwidth));
tb->is_dummy_print = 1;
-
colsepsz = scols_table_is_noencoding(tb) ?
mbs_width(colsep(tb)) :
mbs_safe_width(colsep(tb));
@@ -430,6 +433,11 @@ int __scols_calculate(struct libscols_table *tb, struct ul_buffer *buf)
while (scols_table_next_column(tb, &itr, &cl) == 0) {
int is_last;
+ memset(&cl->wstat, 0, sizeof(cl->wstat));
+ cl->width = 0;
+ cl->width_treeart = 0;
+ scols_column_reset_wrap(cl);
+
if (scols_column_is_hidden(cl))
continue;
diff --git a/libsmartcols/src/column.c b/libsmartcols/src/column.c
index 5700bac..586a485 100644
--- a/libsmartcols/src/column.c
+++ b/libsmartcols/src/column.c
@@ -470,7 +470,7 @@ char *scols_wrapnl_nextchunk(const struct libscols_column *cl __attribute__((unu
* This is built-in function for scols_column_set_wrapfunc(). This function
* walk string separated by \0.
*
- * For example for data "AAA\0BBB\0CCC" the next chunk is "BBB".
+ * For example for data "AAA\0BBB\0CCC\0" the next chunk is "BBB".
*
* Returns: next chunk
*
diff --git a/libsmartcols/src/print.c b/libsmartcols/src/print.c
index 88ab5a2..ab279e3 100644
--- a/libsmartcols/src/print.c
+++ b/libsmartcols/src/print.c
@@ -764,11 +764,11 @@ notree:
}
}
+done:
/* reset wrapping after greatest chunk calculation */
if (cal && scols_column_is_wrap(cl))
scols_column_reset_wrap(cl);
-done:
DBG(COL, ul_debugobj(cl, "__cursor_to_buffer rc=%d", rc));
return rc;
}
@@ -802,8 +802,12 @@ static int print_line(struct libscols_table *tb,
rc = __cursor_to_buffer(tb, buf, 0);
if (!rc)
rc = print_data(tb, buf);
- if (!rc && scols_column_has_pending_wrap(cl))
- pending = 1;
+ if (!rc) {
+ if (scols_column_has_pending_wrap(cl))
+ pending = 1;
+ else
+ scols_column_reset_wrap(cl);
+ }
scols_table_reset_cursor(tb);
}
fputs_color_line_close(tb);
@@ -827,10 +831,12 @@ static int print_line(struct libscols_table *tb,
rc = __cursor_to_buffer(tb, buf, 0);
if (!rc)
rc = print_pending_data(tb, buf);
- if (!rc && scols_column_has_pending_wrap(cl))
- pending = 1;
- if (!rc && !pending)
- scols_column_reset_wrap(cl);
+ if (!rc) {
+ if (scols_column_has_pending_wrap(cl))
+ pending = 1;
+ else
+ scols_column_reset_wrap(cl);
+ }
} else
print_empty_cell(tb, cl, ln, NULL, ul_buffer_get_bufsiz(buf));
scols_table_reset_cursor(tb);