Adjust various truncations.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2016-11-08 17:22:07 +03:00
parent c07eaf1ada
commit 7afd89ddbc
4 changed files with 13 additions and 16 deletions

View File

@ -1092,7 +1092,7 @@ file_progress_show_total (file_op_total_context_t * tctx, file_op_context_t * ct
{
const char *buffer2, *buffer3;
buffer2 = size_trunc_len (5, tctx->copied_bytes, 0, panels_options.kilobyte_si);
buffer2 = size_trunc_len (8, tctx->copied_bytes, 0, panels_options.kilobyte_si);
if (!ctx->progress_totals_computed)
g_snprintf (buffer, sizeof (buffer), _(" Total: %s "), buffer2);
else
@ -1100,7 +1100,7 @@ file_progress_show_total (file_op_total_context_t * tctx, file_op_context_t * ct
char *b2;
b2 = g_strdup (buffer2);
buffer3 = size_trunc_len (5, ctx->progress_bytes, 0, panels_options.kilobyte_si);
buffer3 = size_trunc_len (8, ctx->progress_bytes, 0, panels_options.kilobyte_si);
g_snprintf (buffer, sizeof (buffer), _(" Total: %s/%s "), b2, buffer3);
g_free (b2);
}

View File

@ -180,8 +180,8 @@ info_show_info (WInfo * info)
const char *buffer2;
buffer1 =
g_strdup (size_trunc_len (5, myfs_stats.avail, 1, panels_options.kilobyte_si));
buffer2 = size_trunc_len (5, myfs_stats.total, 1, panels_options.kilobyte_si);
g_strdup (size_trunc_len (8, myfs_stats.avail, 1, panels_options.kilobyte_si));
buffer2 = size_trunc_len (8, myfs_stats.total, 1, panels_options.kilobyte_si);
tty_printf (_("Free space: %s/%s (%d%%)"), buffer1, buffer2,
myfs_stats.total == 0 ? 0 :
(int) (100 * (long double) myfs_stats.avail / myfs_stats.total));
@ -241,7 +241,7 @@ info_show_info (WInfo * info)
{
const char *buffer;
buffer = size_trunc_len (9, st.st_size, 0, panels_options.kilobyte_si);
buffer = size_trunc_len (12, st.st_size, 0, panels_options.kilobyte_si);
tty_printf (_("Size: %s"), buffer);
#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
tty_printf (ngettext (" (%lu block)", " (%lu blocks)",

View File

@ -195,7 +195,7 @@ static panel_field_t panel_fields[] = {
}
,
{
"size", 7, FALSE, J_RIGHT,
"size", 8, FALSE, J_RIGHT,
/* TRANSLATORS: one single character to represent 'size' sort mode */
/* TRANSLATORS: no need to translate 'sort', it's just a context prefix */
N_("sort|s"),
@ -205,7 +205,7 @@ static panel_field_t panel_fields[] = {
}
,
{
"bsize", 7, FALSE, J_RIGHT,
"bsize", 8, FALSE, J_RIGHT,
"",
N_("Block Size"), FALSE, FALSE,
string_file_size_brief,
@ -1159,14 +1159,14 @@ show_free_space (const WPanel * panel)
const char *buffer2;
char tmp[BUF_SMALL];
buffer1 = g_strdup (size_trunc_len (5, myfs_stats.avail, 1, panels_options.kilobyte_si));
buffer2 = size_trunc_len (5, myfs_stats.total, 1, panels_options.kilobyte_si);
buffer1 = g_strdup (size_trunc_len (8, myfs_stats.avail, 1, panels_options.kilobyte_si));
buffer2 = size_trunc_len (8, myfs_stats.total, 1, panels_options.kilobyte_si);
g_snprintf (tmp, sizeof (tmp), " %s/%s (%d%%) ", buffer1, buffer2,
myfs_stats.total == 0 ? 0 :
(int) (100 * (long double) myfs_stats.avail / myfs_stats.total));
g_free (buffer1);
/* FIX LEGACY: use str_term_width1() instead of strlen() here */
widget_move (w, w->lines - 1, w->cols - 2 - (int) strlen (tmp));
widget_move (w, w->lines - 1, w->cols - 2 - str_term_width1 (tmp));
tty_setcolor (NORMAL_COLOR);
tty_print_string (tmp);
}

View File

@ -56,8 +56,6 @@
/*** file scope macro definitions ****************************************************************/
#define BUF_TRUNC_LEN 5 /* The length of the line displays the file size */
/*** file scope type declarations ****************************************************************/
/*** file scope variables ************************************************************************/
@ -171,9 +169,8 @@ mcview_display_status (WView * view)
{
const char *buffer;
buffer =
size_trunc_len (BUF_TRUNC_LEN, mcview_get_filesize (view), 0,
panels_options.kilobyte_si);
buffer = size_trunc_len (8, mcview_get_filesize (view), 0, panels_options.kilobyte_si);
tty_printf ("%9" PRIuMAX "/%s%s %s", (uintmax_t) view->dpy_end, buffer,
mcview_may_still_grow (view) ? "+" : " ",
#ifdef HAVE_CHARSET