Re: utf8 patch for mc, slang 2 version



Hi Bart, list,

On Tue, 2005-09-20 at 08:14 +1200, Bart Oldeman wrote:
> Basically you'd need to apply Fedora's patch, and then (sorry no proper 
> patch here but it's not a big deal)

Attached you'll find a proper patch. I've moved the hunk from global.h
to myslang.h (and dropped the inclusion of slang.h as it is redundant).

Jindrich, please merge this patch with the UTF8 patch. You might even
consider to build the next mc for FC --with-screen=mcslang, as I see the
FC development tree does not yet feature slang-2.

Leonard.

-- 
mount -t life -o ro /dev/dna /genetic/research

diff -pruN mc-4.6.1a/src/help.c mc-4.6.1a_utf8_slang2/src/help.c
--- mc-4.6.1a/src/help.c	2005-11-12 17:46:32.000000000 +0100
+++ mc-4.6.1a_utf8_slang2/src/help.c	2005-11-12 17:52:11.000000000 +0100
@@ -449,7 +449,7 @@ static void help_show (Dlg_head *h, cons
 #ifndef HAVE_SLANG
 			addch (acs_map [c]);
 #else
-#ifdef UTF8
+#if defined(UTF8) && SLANG_VERSION < 20000
 			SLsmg_draw_object (h->y + line + 2, h->x + col + 2, acs_map [c]);
 #else
 			SLsmg_draw_object (h->y + line + 2, h->x + col + 2, c);
diff -pruN mc-4.6.1a/src/myslang.h mc-4.6.1a_utf8_slang2/src/myslang.h
--- mc-4.6.1a/src/myslang.h	2005-11-12 17:46:32.000000000 +0100
+++ mc-4.6.1a_utf8_slang2/src/myslang.h	2005-11-12 18:09:27.000000000 +0100
@@ -11,6 +11,12 @@
 #endif	/* HAVE_SLANG_SLANG_H */
 #endif
 
+#if SLANG_VERSION >= 20000
+#define UTF8 1
+#define SLsmg_Is_Unicode SLsmg_is_utf8_mode()
+void SLsmg_write_nwchars(wchar_t *s, size_t n);
+#endif
+
 #ifdef UTF8
 #    include <wchar.h>
 #endif
diff -pruN mc-4.6.1a/src/slint.c mc-4.6.1a_utf8_slang2/src/slint.c
--- mc-4.6.1a/src/slint.c	2005-09-05 04:14:29.000000000 +0200
+++ mc-4.6.1a_utf8_slang2/src/slint.c	2005-11-12 17:49:21.000000000 +0100
@@ -141,7 +141,9 @@ void
 slang_init (void)
 {
     SLtt_get_terminfo ();
-
+#if SLANG_VERSION >= 20000
+    SLutf8_enable (-1);
+#endif
    /*
     * If the terminal in not in terminfo but begins with a well-known
     * string such as "linux" or "xterm" S-Lang will go on, but the
diff -pruN mc-4.6.1a/src/util.c mc-4.6.1a_utf8_slang2/src/util.c
--- mc-4.6.1a/src/util.c	2005-11-12 17:46:32.000000000 +0100
+++ mc-4.6.1a_utf8_slang2/src/util.c	2005-11-12 17:55:17.000000000 +0100
@@ -56,6 +56,14 @@
 static const char app_text [] = "Midnight-Commander";
 int easy_patterns = 1;
 
+#if SLANG_VERSION >= 20000
+void SLsmg_write_nwchars(wchar_t *s, size_t n)
+{
+    while(n--)
+	SLsmg_write_char(*s++);
+}
+#endif
+
 extern void str_replace(char *s, char from, char to)
 {
     for (; *s != '\0'; s++) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]