mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
(real_warn_same_file): truncate file names if required.
If file name is too long, message window is wider than screen. Truncate file name to fit it in the screen. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
facf199f65
commit
a7833b5b2e
@ -852,10 +852,39 @@ real_warn_same_file (enum OperationMode mode, const char *fmt, const char *a, co
|
||||
char *msg;
|
||||
int result = 0;
|
||||
const char *head_msg;
|
||||
int width_a, width_b, width;
|
||||
|
||||
head_msg = mode == Foreground ? MSG_ERROR : _("Background process error");
|
||||
|
||||
width_a = str_term_width1 (a);
|
||||
width_b = str_term_width1 (b);
|
||||
width = COLS - 8;
|
||||
|
||||
if (width_a > width)
|
||||
{
|
||||
if (width_b > width)
|
||||
{
|
||||
char *s;
|
||||
|
||||
s = g_strndup (str_trunc (a, width), width);
|
||||
b = str_trunc (b, width);
|
||||
msg = g_strdup_printf (fmt, s, b);
|
||||
g_free (s);
|
||||
}
|
||||
else
|
||||
{
|
||||
a = str_trunc (a, width);
|
||||
msg = g_strdup_printf (fmt, a, b);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (width_b > width)
|
||||
b = str_trunc (b, width);
|
||||
|
||||
msg = g_strdup_printf (fmt, a, b);
|
||||
}
|
||||
|
||||
result = query_dialog (head_msg, msg, D_ERROR, 2, _("&Skip"), _("&Abort"));
|
||||
g_free (msg);
|
||||
do_refresh ();
|
||||
|
Loading…
Reference in New Issue
Block a user