Commit 81d5d462 authored by Federico G. Schwindt's avatar Federico G. Schwindt

Truncate output if it's wider than 12 chars

Early version of the patch OK'd by martin@.

Fixes #1855.
parent fd39f38e
......@@ -65,6 +65,8 @@
#define COLW 14
#define COLW_NAME_MIN 24
#define VALUE_MAX 999999999999
struct ma {
unsigned n, nmax;
double acc;
......@@ -714,6 +716,17 @@ print_bytes(WINDOW *w, double val)
wprintw(w, " %12.2f%c", val, q);
}
static void
print_trunc(WINDOW *w, uintmax_t val)
{
if (val > VALUE_MAX) {
while (val > VALUE_MAX)
val /= 1000;
wprintw(w, " %9ju...", val);
} else
wprintw(w, " %12ju", val);
}
static void
draw_line_bytes(WINDOW *w, int y, int x, int X, struct pt *pt)
{
......@@ -740,7 +753,7 @@ draw_line_bytes(WINDOW *w, int y, int x, int X, struct pt *pt)
if (scale && pt->cur > 1024)
print_bytes(w, (double)pt->cur);
else
wprintw(w, " %12ju", (uintmax_t)pt->cur);
print_trunc(w, (uintmax_t)pt->cur);
break;
case COL_CHG:
if (pt->t_last)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment