Re: utf8 patch for mc, slang 2 version



On Mon, 19 Sep 2005, Arkadiusz Miskiewicz wrote:

There are few patches adding UTF-8 support to mc available but they require
modified slang1 library. There is already stable slang-2 version with native
UTF-8 support.

Does anyone know mc utf8 patch that uses slang-2 ?

No, but it's not too hard too change the existing patch.

Basically you'd need to apply Fedora's patch, and then (sorry no proper patch here but it's not a big deal)

in slint.c, use

  SLtt_get_terminfo()
+#if SLANG_VERSION >= 20000
+ SLutf8_enable (-1);
+#endif

in help.c, use

#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);
#endif /* UTF8 */

and then (possibly global.h isn't the best place though):

--- mc/src/util.c       2005-09-18 22:36:30.000000000 +1200
+++ mc-utf8/src/util.c  2005-08-26 13:04:45.000000000 +1200
@@ -48,6 +51,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++) {
@@ -78,9 +89,40 @@
--- mc/src/global.h	2005-08-27 15:51:32.000000000 +1200
+++ mc-utf8/src/global.h	2005-07-13 01:15:40.000000000 +1200
@@ -146,6 +146,13 @@
 #   define N_(String) (String)
 #endif /* !ENABLE_NLS */

+#include <slang.h>
+#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
+
 #include "fs.h"
 #include "util.h"




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