Show not-printable 8-bit symbols in non-UTF-8 locales as dots.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Этот коммит содержится в:
родитель
962dd4d81f
Коммит
38eeaa180c
@ -37,11 +37,15 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
|
#include "../src/tty/tty.h"
|
||||||
|
|
||||||
|
#include "../src/skin/skin.h"
|
||||||
|
|
||||||
#include "../src/global.h"
|
#include "../src/global.h"
|
||||||
#include "../src/main.h"
|
#include "../src/main.h"
|
||||||
#include "../src/charsets.h"
|
#include "../src/charsets.h"
|
||||||
#include "../src/tty/tty.h"
|
#include "../src/util.h" /* is_printable() */
|
||||||
#include "../src/skin/skin.h"
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
/*** global variables ****************************************************************************/
|
/*** global variables ****************************************************************************/
|
||||||
@ -80,10 +84,11 @@ mcview_display_text (mcview_t * view)
|
|||||||
curr = curr->next;
|
curr = curr->next;
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
|
tty_setcolor (NORMAL_COLOR);
|
||||||
|
|
||||||
if (row >= height)
|
if (row >= height)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
tty_setcolor (NORMAL_COLOR);
|
|
||||||
#ifdef HAVE_CHARSET
|
#ifdef HAVE_CHARSET
|
||||||
if (view->utf8) {
|
if (view->utf8) {
|
||||||
gboolean read_res = TRUE;
|
gboolean read_res = TRUE;
|
||||||
@ -144,15 +149,20 @@ mcview_display_text (mcview_t * view)
|
|||||||
#ifdef HAVE_CHARSET
|
#ifdef HAVE_CHARSET
|
||||||
if (utf8_display) {
|
if (utf8_display) {
|
||||||
if (!view->utf8)
|
if (!view->utf8)
|
||||||
c = convert_from_8bit_to_utf_c (c, view->converter);
|
c = convert_from_8bit_to_utf_c ((unsigned char) c, view->converter);
|
||||||
if (!g_unichar_isprint (c))
|
if (!g_unichar_isprint (c))
|
||||||
c = '.';
|
c = '.';
|
||||||
} else if (view->utf8)
|
} else if (view->utf8)
|
||||||
c = convert_from_utf_to_current_c (c, view->converter);
|
c = convert_from_utf_to_current_c (c, view->converter);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
c = convert_to_display_c (c);
|
c = convert_to_display_c (c);
|
||||||
|
|
||||||
|
if (!is_printable (c))
|
||||||
|
c = '.';
|
||||||
|
}
|
||||||
|
|
||||||
tty_print_anychar (c);
|
tty_print_anychar (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user