]> git.ipfire.org Git - thirdparty/util-linux.git/commit
libsmartcols: support custom wrap and remove SCOLS_FL_WRAPNL
authorKarel Zak <kzak@redhat.com>
Mon, 26 Sep 2016 09:20:07 +0000 (11:20 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 26 Sep 2016 09:20:07 +0000 (11:20 +0200)
commit949ea05f1af647834db24b9172ac006488d2e4f4
tree0e735393ebe57f1f53cab8da3288b96fcc756f27
parent0d71eb9c4bed2949fd09759e8eb0071702eaa1e7
libsmartcols: support custom wrap and remove SCOLS_FL_WRAPNL

This new API provides full control on multi-line cells, you can wrap
text by new lines (build-in support) or by another way (after words,
commas, etc.) Changes:

* new scols_column_set_wrapfunc() sets pointers to two callback functions

   1/ chunksize() - returns largest data chunk size; used when we
                    calculate columns width
   2/ nextchunk() - terminate the current chunk and returns pointer to
                    the next; used when we print data

* remove SCOLS_FL_WRAPNL and add new functions scols_wrapnl_chunksize()
  and scols_wrapnl_nextchunk() to provide build-in functionality to
  wrap cells on \n

* remove scols_column_is_wrapnl() add scols_column_is_customwrap()
  (returns true if custom wrap functions are defined)

* add scols_column_set_safechars() and scols_column_get_safechars() to
  allow to control output encoding, safe chars are not encoded by \xFOO

* modify "fromfile" test code to use build-in scols_wrapnl_* callbacks
  for "wrapnl" tests

* add new function scols_column_get_table()

Signed-off-by: Karel Zak <kzak@redhat.com>
libsmartcols/docs/libsmartcols-sections.txt
libsmartcols/samples/fromfile.c
libsmartcols/src/column.c
libsmartcols/src/libsmartcols.h.in
libsmartcols/src/libsmartcols.sym
libsmartcols/src/smartcolsP.h
libsmartcols/src/table_print.c