summaryrefslogtreecommitdiffstats
path: root/libsmartcols/src/table.c
diff options
context:
space:
mode:
authorKarel Zak2015-12-07 12:03:52 +0100
committerKarel Zak2015-12-07 12:03:52 +0100
commitdf73852b6ec0d22c947647c03f447ce2edc22904 (patch)
tree107eb89dc8f2b943b7a522abe64f651a75bf57c1 /libsmartcols/src/table.c
parentRevert "cfdisk: make sure that output fits to terminal width" (diff)
downloadkernel-qcow2-util-linux-df73852b6ec0d22c947647c03f447ce2edc22904.tar.gz
kernel-qcow2-util-linux-df73852b6ec0d22c947647c03f447ce2edc22904.tar.xz
kernel-qcow2-util-linux-df73852b6ec0d22c947647c03f447ce2edc22904.zip
libsmartcols: add scols_table_enable_nowrap()
This allows to use libsmartcols in ncurses programs without any additional voodoo. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libsmartcols/src/table.c')
-rw-r--r--libsmartcols/src/table.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/libsmartcols/src/table.c b/libsmartcols/src/table.c
index a42ae514d..a9beab122 100644
--- a/libsmartcols/src/table.c
+++ b/libsmartcols/src/table.c
@@ -839,6 +839,24 @@ int scols_table_enable_maxout(struct libscols_table *tb, int enable)
}
/**
+ * scols_table_enable_nowrap:
+ * @tb: table
+ * @enable: 1 or 0
+ *
+ * Never continue on next line, remove last column(s) when too large, truncate last column.
+ *
+ * Returns: 0 on success, negative number in case of an error.
+ */
+int scols_table_enable_nowrap(struct libscols_table *tb, int enable)
+{
+ if (!tb)
+ return -EINVAL;
+ DBG(TAB, ul_debugobj(tb, "nowrap: %s", enable ? "ENABLE" : "DISABLE"));
+ tb->no_wrap = enable ? 1 : 0;
+ return 0;
+}
+
+/**
* scols_table_colors_wanted:
* @tb: table
*