@@ -692,7 +692,7 @@ print_aligned_text(const printTableContent *cont, FILE *fout)
692
692
if (opt_border == 0 )
693
693
width_total = col_count ;
694
694
else if (opt_border == 1 )
695
- width_total = col_count * 3 - 1 ;
695
+ width_total = col_count * 3 - (( col_count > 0 ) ? 1 : 0 ) ;
696
696
else
697
697
width_total = col_count * 3 + 1 ;
698
698
total_header_width = width_total ;
@@ -928,7 +928,7 @@ print_aligned_text(const printTableContent *cont, FILE *fout)
928
928
fputs (!header_done [i ] ? format -> header_nl_right : " " ,
929
929
fout );
930
930
931
- if (opt_border != 0 && i < col_count - 1 )
931
+ if (opt_border != 0 && col_count > 0 && i < col_count - 1 )
932
932
fputs (dformat -> midvrule , fout );
933
933
}
934
934
curr_nl_line ++ ;
@@ -983,7 +983,8 @@ print_aligned_text(const printTableContent *cont, FILE *fout)
983
983
struct lineptr * this_line = & col_lineptrs [j ][curr_nl_line [j ]];
984
984
int bytes_to_output ;
985
985
int chars_to_output = width_wrap [j ];
986
- bool finalspaces = (opt_border == 2 || j < col_count - 1 );
986
+ bool finalspaces = (opt_border == 2 ||
987
+ (col_count > 0 && j < col_count - 1 ));
987
988
988
989
/* Print left-hand wrap or newline mark */
989
990
if (opt_border != 0 )
@@ -1077,11 +1078,11 @@ print_aligned_text(const printTableContent *cont, FILE *fout)
1077
1078
fputs (format -> wrap_right , fout );
1078
1079
else if (wrap [j ] == PRINT_LINE_WRAP_NEWLINE )
1079
1080
fputs (format -> nl_right , fout );
1080
- else if (opt_border == 2 || j < col_count - 1 )
1081
+ else if (opt_border == 2 || ( col_count > 0 && j < col_count - 1 ) )
1081
1082
fputc (' ' , fout );
1082
1083
1083
1084
/* Print column divider, if not the last column */
1084
- if (opt_border != 0 && j < col_count - 1 )
1085
+ if (opt_border != 0 && ( col_count > 0 && j < col_count - 1 ) )
1085
1086
{
1086
1087
if (wrap [j + 1 ] == PRINT_LINE_WRAP_WRAP )
1087
1088
fputs (format -> midvrule_wrap , fout );
@@ -1236,8 +1237,18 @@ print_aligned_vertical(const printTableContent *cont, FILE *fout)
1236
1237
if (cont -> cells [0 ] == NULL && cont -> opt -> start_table &&
1237
1238
cont -> opt -> stop_table )
1238
1239
{
1239
- if (!opt_tuples_only && cont -> opt -> default_footer )
1240
- fprintf (fout , _ ("(No rows)\n" ));
1240
+ printTableFooter * footers = footers_with_default (cont );
1241
+
1242
+ if (!opt_tuples_only && !cancel_pressed && footers )
1243
+ {
1244
+ printTableFooter * f ;
1245
+
1246
+ for (f = footers ; f ; f = f -> next )
1247
+ fprintf (fout , "%s\n" , f -> data );
1248
+ }
1249
+
1250
+ fputc ('\n' , fout );
1251
+
1241
1252
return ;
1242
1253
}
1243
1254
0 commit comments