It is better to fill the empty columns for visualization,
so its easier identify the whole line.

Signed-off-by: Vadim Kochan <vadi...@gmail.com>
---
 ui.c | 18 +++++++++++++-----
 ui.h |  1 +
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/ui.c b/ui.c
index cfa1471..9f0a0e0 100644
--- a/ui.c
+++ b/ui.c
@@ -42,10 +42,11 @@ void ui_table_init(struct ui_table *tbl)
        if (ui == UI_CURSES)
                getsyx(tbl->y, tbl->x);
 
-       tbl->rows_y  = tbl->y;
-       tbl->width   = COLS;
-       tbl->height  = LINES - 2;
-       tbl->col_pad = 1;
+       tbl->rows_y      = tbl->y;
+       tbl->width       = COLS;
+       tbl->height      = LINES - 2;
+       tbl->col_pad     = 1;
+       tbl->default_col = "*";
 
        INIT_LIST_HEAD(&tbl->cols);
 }
@@ -140,7 +141,14 @@ void ui_table_clear(struct ui_table *tbl)
 static void __ui_table_row_print(struct ui_table *tbl, struct ui_col *col,
                                 const char *str)
 {
-       ui_print_yx(tbl->rows_y, col->pos, UI_ALIGN_COL(col), col->len, 
col->len, str);
+       const char *tmp;
+
+       if (!str || !strlen(str))
+               tmp = tbl->default_col;
+       else
+               tmp = str;
+
+       ui_print_yx(tbl->rows_y, col->pos, UI_ALIGN_COL(col), col->len, 
col->len, tmp);
        ui_print_yx(tbl->rows_y, col->pos + col->len, "%*s", tbl->col_pad, " ");
 }
 
diff --git a/ui.h b/ui.h
index b98fdc2..dfd7f09 100644
--- a/ui.h
+++ b/ui.h
@@ -35,6 +35,7 @@ struct ui_table {
        int col_pad;
        int width;
        int height;
+       const char *default_col;
 };
 
 extern void ui_init(enum ui_type mode);
-- 
2.6.3

-- 
You received this message because you are subscribed to the Google Groups 
"netsniff-ng" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to netsniff-ng+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to