diff options
author | Karel Zak <kzak@redhat.com> | 2011-11-10 02:02:38 +0100 |
---|---|---|
committer | Karel Zak <kzak@redhat.com> | 2011-11-10 12:39:02 +0100 |
commit | 7aa69cf2e39b00181e645dd2e33913ed7be0afa6 (patch) | |
tree | 2eab1c2616f085dac038172a0c856421eadc6367 /include | |
parent | 18c5bee13b506f9591c36564e9b1c8a6b51c9001 (diff) | |
download | util-linux-7aa69cf2e39b00181e645dd2e33913ed7be0afa6.tar.gz |
lib,tt: add TT_FL_NOEXTREMES
If you mark a column with TT_FL_NOEXTREMES flag then extremely
large fields will no have effect to column width. Foe example:
without the TT_FL_NOEXTREMES flag for the 'AAA' column:
AAA BBB CCC DDD
aa bbb ccc ddd
aaaaaaaaaaa bb ccc ddd
aa bb ccc ddd
aa bb ccc ddd
with the flags:
AAA BBB CCC DDD
aa bbb ccc dddddddddd
aaaaaaaaaaa
bb ccc dddddddd
aa bb ccc dddddd
aa bb ccc ddddddddd
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/tt.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/include/tt.h b/include/tt.h index 1ae71337..9b5f15a9 100644 --- a/include/tt.h +++ b/include/tt.h @@ -23,10 +23,11 @@ enum { /* * Column flags */ - TT_FL_TRUNC = (1 << 5), - TT_FL_TREE = (1 << 6), - TT_FL_RIGHT = (1 << 7), - TT_FL_STRICTWIDTH = (1 << 8) + TT_FL_TRUNC = (1 << 5), /* truncate fields data if necessary */ + TT_FL_TREE = (1 << 6), /* use tree "ascii art" */ + TT_FL_RIGHT = (1 << 7), /* align to the right */ + TT_FL_STRICTWIDTH = (1 << 8), /* don't reduce width if column is empty */ + TT_FL_NOEXTREMES = (1 << 9) /* ignore extreme fields when count column width*/ }; struct tt { @@ -46,10 +47,13 @@ struct tt_column { size_t seqnum; size_t width; /* real column width */ - size_t width_min; /* minimal width (width of header) */ + size_t width_min; /* minimal width (usually header width) */ + size_t width_max; /* maximal width */ + size_t width_avg; /* average width, used to detect extreme fields */ double width_hint; /* hint (N < 1 is in percent of termwidth) */ int flags; + int is_extreme; struct list_head cl_columns; }; |