1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-27 00:40:26 +00:00

Don't rely on obscure printf features.

They may not work on all platforms.
This commit is contained in:
Calvin Rose 2020-01-18 00:27:00 -06:00
parent a8e4c4bed0
commit 521a29446f

View File

@ -487,11 +487,16 @@ static void kshowcomp(void) {
if (cols == 0) cols = 1; if (cols == 0) cols = 1;
int current_col = 0; int current_col = 0;
for (int i = 0; i < gbl_match_count; i++) { for (int i = 0; i < gbl_match_count; i++) {
if (current_col == 0) printf("\n"); if (current_col == 0) putc('\n', stdout);
printf("%-*s", col_width, (const char *) gbl_matches[i].bytes); JanetByteView s = gbl_matches[i];
printf("%s", (const char *) s.bytes);
for (int j = s.len; j < col_width; j++) {
putc(' ', stdout);
}
current_col = (current_col + 1) % cols; current_col = (current_col + 1) % cols;
} }
printf("\n"); putc('\n', stdout);
fflush(stdout);
rawmode(); rawmode();
} }