From d21917048cf290dc227c7e5e959778c2da3362fa Mon Sep 17 00:00:00 2001 From: GoTaR Date: Sun, 27 Feb 2011 14:50:32 +0000 Subject: [PATCH] Ticket #1668: Screen and input corruption under xterm [non-UTF] The problem: viewing binary files contain char 0x9A leads to massive screen corruption and Search dialog pops up with 1;2c search string (multiple times depending on actual screen contents). So it looks like the file 'presses' F7 or / and shift-right_arrow for every specified character combination occurrence. In case of bigger files it's impossible to exit from such viewer, as search dialog keeps popping up after closing. Signed-off-by: Ilia Maslakov Signed-off-by: Andrew Borodin --- lib/tty/tty-slang.c | 3 +++ src/filemanager/midnight.c | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/lib/tty/tty-slang.c b/lib/tty/tty-slang.c index f8ed6f290..a80ba81b6 100644 --- a/lib/tty/tty-slang.c +++ b/lib/tty/tty-slang.c @@ -41,6 +41,7 @@ #include "lib/global.h" #include "lib/strutil.h" /* str_term_form */ +#include "lib/util.h" /* is_printable() */ #include "tty-internal.h" /* slow_tty */ #include "tty.h" @@ -627,6 +628,8 @@ tty_print_anychar (int c) } else { + if (!is_printable (c)) + c = '.'; SLsmg_write_char ((SLwchar_Type) ((unsigned int) c)); } } diff --git a/src/filemanager/midnight.c b/src/filemanager/midnight.c index bd1811633..9d5409605 100644 --- a/src/filemanager/midnight.c +++ b/src/filemanager/midnight.c @@ -746,6 +746,15 @@ init_xterm_support (void) { xterm_flag = 1; +#ifdef HAVE_SLANG + /* For 8-bit locales, NCurses handles 154 (0x9A) symbol properly, while S-Lang + * requires SLsmg_Display_Eight_Bit >= 154 (OR manual filtering if xterm display + * detected - but checking TERM would fail under screen, OR running xterm + * with allowC1Printable). + */ + tty_display_8bit (FALSE); +#endif + /* Default to the standard xterm sequence */ if (!xmouse_seq) { -- 2.11.4.GIT