(edit_draw_this_line): fix printable character recognition in 8-bit locales when displaying UTF-8

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
This commit is contained in:
Andrew Borodin 2024-09-24 12:15:17 +02:00 committed by Yury V. Zaytsev
parent c079a09612
commit f4ef5c64a4

View File

@ -573,6 +573,7 @@ edit_draw_this_line (WEdit *edit, off_t b, long row, long start_col, long end_co
unsigned int c; unsigned int c;
gboolean wide_width_char = FALSE; gboolean wide_width_char = FALSE;
gboolean control_char = FALSE; gboolean control_char = FALSE;
gboolean printable;
p->ch = 0; p->ch = 0;
p->style = q == edit->buffer.curs1 ? MOD_CURSOR : 0; p->style = q == edit->buffer.curs1 ? MOD_CURSOR : 0;
@ -759,34 +760,30 @@ edit_draw_this_line (WEdit *edit, off_t b, long row, long start_col, long end_co
control_char = TRUE; control_char = TRUE;
break; break;
} }
#ifdef HAVE_CHARSET #ifdef HAVE_CHARSET
if (edit->utf8) if (edit->utf8)
{ {
if (g_unichar_isprint (c)) if (mc_global.utf8_display)
p->ch = c; /* c is gunichar */
printable = g_unichar_isprint (c);
else else
{ /* c was gunichar; now c is 8-bit char converted from gunichar */
p->ch = '.'; printable = is_printable (c);
p->style = abn_style;
}
p++;
} }
else else
#endif #endif
/* c is 8-bit char */
printable = is_printable (c);
if (printable)
p->ch = c;
else
{ {
if ((mc_global.utf8_display && g_unichar_isprint (c)) || p->ch = '.';
(!mc_global.utf8_display && is_printable (c))) p->style = abn_style;
{
p->ch = c;
p++;
}
else
{
p->ch = '.';
p->style = abn_style;
p++;
}
} }
p++;
col++; col++;
break; break;
} /* case */ } /* case */