From 6e55676f47c2887ecc8408914ba66ee5a514498c Mon Sep 17 00:00:00 2001 From: pk910 Date: Mon, 22 Aug 2011 23:28:54 +0200 Subject: [PATCH] improved table_end --- tools.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tools.c b/tools.c index 3bc3374..70cfc1e 100644 --- a/tools.c +++ b/tools.c @@ -145,15 +145,16 @@ char **table_end(struct Table *table) { for(i = 0; i < strlen(table->contents[row][col]); i++) { table->table_lines[row][pos++] = table->contents[row][col][i]; } - for(;i < table->maxwidth[col]; i++) { + if(col < table->width-1) { + for(;i < table->maxwidth[col]; i++) { + table->table_lines[row][pos++] = ' '; + } table->table_lines[row][pos++] = ' '; - } + } else + table->table_lines[row][pos++] = '\0'; + if(table->col_flags[col] & TABLE_FLAG_COL_BOLD) table->table_lines[row][pos++] = '\002'; - if(col < table->width-1) - table->table_lines[row][pos++] = ' '; - else - table->table_lines[row][pos++] = '\0'; } } return table->table_lines; -- 2.20.1