SOURCES: mc-utf8.patch - updated for mc 4.6.2pre1 with removed whi...

hawk hawk at pld-linux.org
Tue May 6 09:32:42 CEST 2008


Author: hawk                         Date: Tue May  6 07:32:42 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- updated for mc 4.6.2pre1 with removed whitespace replacing, regenerated
  whole diff

---- Files affected:
SOURCES:
   mc-utf8.patch (1.9 -> 1.10) 

---- Diffs:

================================================================
Index: SOURCES/mc-utf8.patch
diff -u SOURCES/mc-utf8.patch:1.9 SOURCES/mc-utf8.patch:1.10
--- SOURCES/mc-utf8.patch:1.9	Wed Apr 16 20:02:12 2008
+++ SOURCES/mc-utf8.patch	Tue May  6 09:32:37 2008
@@ -1,5423 +1,5461 @@
-diff -up mc-4.6.2-pre1/src/filegui.c.utf8 mc-4.6.2-pre1/src/filegui.c
---- mc-4.6.2-pre1/src/filegui.c.utf8	2007-08-23 15:16:39.000000000 +0200
-+++ mc-4.6.2-pre1/src/filegui.c	2008-02-25 14:56:22.000000000 +0100
-@@ -65,6 +65,7 @@
- #include "filegui.h"
- #include "key.h"		/* get_event */
- #include "util.h"               /* strip_password() */
-+#include "tty.h"
- 
- /* }}} */
- 
-@@ -563,8 +564,8 @@ init_replace (FileOpContext *ctx, enum O
- 	 * longest of "Overwrite..." labels 
- 	 * (assume "Target date..." are short enough)
- 	 */
--	l1 = max (strlen (rd_widgets[6].text),
--		  strlen (rd_widgets[11].text));
-+	l1 = max (mbstrlen (rd_widgets[6].text),
-+		  mbstrlen (rd_widgets[11].text));
- 
- 	/* longest of button rows */
- 	i = sizeof (rd_widgets) / sizeof (rd_widgets[0]);
-@@ -575,7 +576,7 @@ init_replace (FileOpContext *ctx, enum O
- 		    l2 = max (l2, l);
- 		    l = 0;
- 		}
--		l += strlen (rd_widgets[i].text) + 4;
-+		l += mbstrlen (rd_widgets[i].text) + 4;
- 	    }
- 	}
- 	l2 = max (l2, l);	/* last row */
-@@ -593,12 +594,12 @@ init_replace (FileOpContext *ctx, enum O
- 		    l = l1;
- 		}
- 		rd_widgets[i].xpos = l;
--		l += strlen (rd_widgets[i].text) + 4;
-+		l += mbstrlen (rd_widgets[i].text) + 4;
- 	    }
- 	}
- 	/* Abort button is centered */
- 	rd_widgets[1].xpos =
--	    (rd_xlen - strlen (rd_widgets[1].text) - 3) / 2;
-+	    (rd_xlen - mbstrlen (rd_widgets[1].text) - 3) / 2;
-     }
- #endif				/* ENABLE_NLS */
- 
-@@ -617,7 +618,7 @@ init_replace (FileOpContext *ctx, enum O
- 
-     ADD_RD_LABEL (ui, 0,
- 		  name_trunc (ui->replace_filename,
--			      rd_trunc - strlen (rd_widgets[0].text)), 0);
-+			      rd_trunc - mbstrlen (rd_widgets[0].text)), 0);
-     ADD_RD_BUTTON (1);
- 
-     ADD_RD_BUTTON (2);
-@@ -804,36 +805,36 @@ fmd_init_i18n (int force)
- 	if (fmd_widgets[i].text[0] != '\0')
- 	    fmd_widgets[i].text = _(fmd_widgets[i].text);
- 
--    len = strlen (fmd_widgets[FMCB11].text)
--	+ strlen (fmd_widgets[FMCB21].text) + 15;
-+    len = mbstrlen (fmd_widgets[FMCB11].text)
-+	+ mbstrlen (fmd_widgets[FMCB21].text) + 15;
-     fmd_xlen = max (fmd_xlen, len);
- 
--    len = strlen (fmd_widgets[FMCB12].text)
--	+ strlen (fmd_widgets[FMCB22].text) + 15;
-+    len = mbstrlen (fmd_widgets[FMCB12].text)
-+	+ mbstrlen (fmd_widgets[FMCB22].text) + 15;
-     fmd_xlen = max (fmd_xlen, len);
+diff -urNp mc-4.6.2-pre1.orig/acinclude.m4 mc-4.6.2-pre1/acinclude.m4
+--- mc-4.6.2-pre1.orig/acinclude.m4	2006-09-07 17:59:51.000000000 +0200
++++ mc-4.6.2-pre1/acinclude.m4	2008-05-05 12:41:18.000000000 +0200
+@@ -399,14 +399,14 @@ AC_DEFUN([MC_WITH_SLANG], [
+     fi
  
--    len = strlen (fmd_widgets[FMBRGT].text)
--	+ strlen (fmd_widgets[FMBLFT].text) + 11;
-+    len = mbstrlen (fmd_widgets[FMBRGT].text)
-+	+ mbstrlen (fmd_widgets[FMBLFT].text) + 11;
+     dnl Unless external S-Lang was requested, reject S-Lang with UTF-8 hacks
+-    if test x$with_screen = xslang; then
+-	:
+-	m4_if([$1], strict, ,
+-	      [AC_CHECK_LIB([slang], [SLsmg_write_nwchars],
+-	    		    [AC_MSG_WARN([Rejecting S-Lang with UTF-8 support, \
+-it's not fully supported yet])
+-	      with_screen=mcslang])])
+-    fi
++dnl    if test x$with_screen = xslang; then
++dnl	:
++dnl	m4_if([$1], strict, ,
++dnl	      [AC_CHECK_LIB([slang], [SLsmg_write_nwchars],
++dnl	    		    [AC_MSG_WARN([Rejecting S-Lang with UTF-8 support, \
++dnl it's not fully supported yet])
++dnl	      with_screen=mcslang])])
++dnl    fi
  
- #ifdef FMBMID
--    len += strlen (fmd_widgets[FMBMID].text) + 6;
-+    len += mbstrlen (fmd_widgets[FMBMID].text) + 6;
- #endif
+     if test x$with_screen = xslang; then
+ 	AC_DEFINE(HAVE_SYSTEM_SLANG, 1,
+diff -urNp mc-4.6.2-pre1.orig/edit/edit.c mc-4.6.2-pre1/edit/edit.c
+--- mc-4.6.2-pre1.orig/edit/edit.c	2008-05-05 12:38:48.000000000 +0200
++++ mc-4.6.2-pre1/edit/edit.c	2008-05-05 12:41:18.000000000 +0200
+@@ -102,7 +102,11 @@ char *option_backup_ext = NULL;
  
-     fmd_xlen = max (fmd_xlen, len + 4);
+ static void user_menu (WEdit *edit);
  
-     len = (fmd_xlen - (len + 6)) / 2;
-     i = fmd_widgets[FMBLFT].relative_x = len + 3;
--    i += strlen (fmd_widgets[FMBLFT].text) + 8;
-+    i += mbstrlen (fmd_widgets[FMBLFT].text) + 8;
++#ifndef UTF8
+ int edit_get_byte (WEdit * edit, long byte_index)
++#else
++mc_wchar_t edit_get_byte (WEdit * edit, long byte_index)
++#endif
+ {
+     unsigned long p;
+     if (byte_index >= (edit->curs1 + edit->curs2) || byte_index < 0)
+@@ -131,7 +135,7 @@ edit_init_buffers (WEdit *edit)
  
- #ifdef FMBMID
-     fmd_widgets[FMBMID].relative_x = i;
--    i += strlen (fmd_widgets[FMBMID].text) + 6;
-+    i += mbstrlen (fmd_widgets[FMBMID].text) + 6;
- #endif
+     edit->curs1 = 0;
+     edit->curs2 = 0;
+-    edit->buffers2[0] = g_malloc (EDIT_BUF_SIZE);
++    edit->buffers2[0] = g_malloc (EDIT_BUF_SIZE * sizeof(mc_wchar_t));
+ }
  
-     fmd_widgets[FMBRGT].relative_x = i;
+ /*
+@@ -156,7 +160,7 @@ edit_load_file_fast (WEdit *edit, const 
+     }
  
- #define	chkbox_xpos(i) \
--	fmd_widgets [i].relative_x = fmd_xlen - strlen (fmd_widgets [i].text) - 6
-+	fmd_widgets [i].relative_x = fmd_xlen - mbstrlen (fmd_widgets [i].text) - 6
+     if (!edit->buffers2[buf2])
+-	edit->buffers2[buf2] = g_malloc (EDIT_BUF_SIZE);
++	edit->buffers2[buf2] = g_malloc (EDIT_BUF_SIZE  * sizeof(mc_wchar_t));
  
-     chkbox_xpos (FMCB0);
-     chkbox_xpos (FMCB21);
-@@ -855,7 +856,7 @@ fmd_init_i18n (int force)
+     mc_read (file,
+ 	     (char *) edit->buffers2[buf2] + EDIT_BUF_SIZE -
+@@ -166,7 +170,7 @@ edit_load_file_fast (WEdit *edit, const 
+     for (buf = buf2 - 1; buf >= 0; buf--) {
+ 	/* edit->buffers2[0] is already allocated */
+ 	if (!edit->buffers2[buf])
+-	    edit->buffers2[buf] = g_malloc (EDIT_BUF_SIZE);
++	    edit->buffers2[buf] = g_malloc (EDIT_BUF_SIZE * sizeof(mc_wchar_t));
+ 	mc_read (file, (char *) edit->buffers2[buf], EDIT_BUF_SIZE);
+     }
  
- char *
- file_mask_dialog (FileOpContext *ctx, FileOperation operation, const char *text,
--		  const char *def_text, int only_one, int *do_background)
-+		  const char *def_text_orig, int only_one, int *do_background)
+@@ -239,9 +243,44 @@ edit_insert_stream (WEdit * edit, FILE *
  {
-     int source_easy_patterns = easy_patterns;
-     char *source_mask, *orig_mask, *dest_dir, *tmpdest;
-@@ -864,12 +865,20 @@ file_mask_dialog (FileOpContext *ctx, Fi
-     struct stat buf;
-     int val;
-     QuickDialog Quick_input;
--
-+    char *def_text;
-     g_return_val_if_fail (ctx != NULL, NULL);
+     int c;
+     long i = 0;
+-    while ((c = fgetc (f)) >= 0) {
++#ifndef UTF8
++    while ((c = fgetc (f)) != EOF) {
+ 	edit_insert (edit, c);
+ 	i++;
++#else /* UTF8 */
++    unsigned char buf[MB_LEN_MAX];
++    int charpos = 0;
++    mbstate_t mbs;
 +
-+    def_text = g_strdup(def_text_orig);
++    while ((c = fgetc (f)) != EOF) {
++	mc_wchar_t wc;
++	int size;
++	int j;
 +
- #if 0
-     message (1, __FUNCTION__, "text = `%s' \n def_text = `%s'", text,
- 		def_text);
- #endif
++	buf[charpos++] = c;
 +
-+#ifdef UTF8
-+	fix_utf8(def_text);
-+#endif
++        memset (&mbs, 0, sizeof (mbs));
++	size = mbrtowc(&wc, (char *)buf, charpos, &mbs);
 +
-     fmd_init_i18n (FALSE);
- 
-     /* Set up the result pointers */
-@@ -928,6 +937,7 @@ file_mask_dialog (FileOpContext *ctx, Fi
-     orig_mask = source_mask;
-     if (!dest_dir || !*dest_dir) {
- 	g_free (source_mask);
-+        g_free(def_text);
- 	return dest_dir;
-     }
-     if (source_easy_patterns) {
-@@ -981,5 +991,6 @@ file_mask_dialog (FileOpContext *ctx, Fi
++	if (size == -2) 
++	    continue; /* incomplete */
++
++	else if (size >= 0) {
++	    edit_insert (edit, wc);
++	    i++;
++	    charpos = 0;
++	    continue;
++	}
++	else {
++
++		/* invalid  */
++#ifdef __STDC_ISO_10646__
++		for (j=0; j<charpos; j++)
++		    edit_insert (edit, BINARY_CHAR_OFFSET + (mc_wchar_t)buf[j]);
++#endif
++		charpos = 0;
++	}
++#endif /* UTF8 */
      }
-     if (val == B_USER)
- 	*do_background = 1;
-+    g_free(def_text);
-     return dest_dir;
+     return i;
  }
-diff -up mc-4.6.2-pre1/src/tty.h.utf8 mc-4.6.2-pre1/src/tty.h
---- mc-4.6.2-pre1/src/tty.h.utf8	2006-05-15 15:26:18.000000000 +0200
-+++ mc-4.6.2-pre1/src/tty.h	2008-02-25 14:56:22.000000000 +0100
-@@ -8,6 +8,8 @@
-     of ifdefs in the other files small.
-  */
- 
-+#include <glib.h>	/* gboolean is used here */
+@@ -249,9 +288,32 @@ edit_insert_stream (WEdit * edit, FILE *
+ long edit_write_stream (WEdit * edit, FILE * f)
+ {
+     long i;
++#ifndef UTF8
+     for (i = 0; i < edit->last_byte; i++)
+ 	if (fputc (edit_get_byte (edit, i), f) < 0)
+ 	    break;
++#else /* UTF8 */
++    for (i = 0; i < edit->last_byte; i++) {
++	mc_wchar_t wc = edit_get_byte (edit, i);
++	int res;
++	char tmpbuf[MB_LEN_MAX];
++        mbstate_t mbs;
 +
- #ifdef HAVE_SLANG
- #   include "myslang.h"
- #endif
-diff -up mc-4.6.2-pre1/src/widget.c.utf8 mc-4.6.2-pre1/src/widget.c
---- mc-4.6.2-pre1/src/widget.c.utf8	2006-05-29 13:58:43.000000000 +0200
-+++ mc-4.6.2-pre1/src/widget.c	2008-02-25 14:56:22.000000000 +0100
-@@ -36,6 +36,9 @@
- 
- #include "global.h"
- #include "tty.h"
-+#ifdef UTF8
-+#include <wctype.h>
-+#endif /* UTF8 */
- #include "color.h"
- #include "mouse.h"
- #include "dialog.h"
-@@ -182,6 +185,11 @@ button_callback (Widget *w, widget_msg_t
- 	if (b->hotpos >= 0) {
- 	    widget_selectcolor (w, b->selected, TRUE);
- 	    widget_move (w, 0, b->hotpos + off);
-+#ifdef UTF8
-+	    if (SLsmg_Is_Unicode)
-+		SLsmg_write_nwchars (&b->hotwc, 1);
-+	    else
-+#endif
- 	    addch ((unsigned char) b->text[b->hotpos]);
- 	}
- 	return MSG_HANDLED;
-@@ -215,7 +223,7 @@ button_event (Gpm_Event *event, void *da
- static int
- button_len (const char *text, unsigned int flags)
- {
--    int ret = strlen (text);
-+    int ret = mbstrlen (text);
-     switch (flags){
- 	case DEFPUSH_BUTTON:
- 	    ret += 6;
-@@ -238,14 +246,36 @@ button_len (const char *text, unsigned i
-  * the button text is g_malloc()ed, we can safely change and shorten it.
-  */
- static void
--button_scan_hotkey (WButton *b)
-+scan_hotkey (char *text, int *hotposp, int *hotkeyp, wchar_t *hotwcp)
- {
--    char *cp = strchr (b->text, '&');
-+    char *cp = strchr (text, '&');
- 
-     if (cp != NULL && cp[1] != '\0') {
--	g_strlcpy (cp, cp + 1, strlen (cp));
--	b->hotkey = tolower ((unsigned char) *cp);
--	b->hotpos = cp - b->text;
-+#ifdef UTF8
-+        if (SLsmg_Is_Unicode) {
-+	    mbstate_t s;
-+	    int len;
++        memset (&mbs, 0, sizeof (mbs));
 +
-+	    *cp = '\0';
-+	    memset (&s, 0, sizeof (s));
-+	    len = mbrtowc (hotwcp, cp + 1, MB_CUR_MAX, &s);
-+	    if (len > 0) {
-+		*hotposp = mbstrlen (text);
-+		if (*hotposp < 0) {
-+		    *hotposp = -1;
-+		} else {
-+		    /* FIXME */
-+		    *hotkeyp = tolower (*hotwcp);
-+		}
-+	    }
++#ifdef __STDC_ISO_10646__ 
++	if (wc >= BINARY_CHAR_OFFSET && wc < (BINARY_CHAR_OFFSET + 256)) {
++	    res = 1;
++	    tmpbuf[0] = (char) (wc - BINARY_CHAR_OFFSET);
 +	} else
 +#endif
-+	{
-+	    *hotkeyp = tolower (cp[1]);
-+	    *hotposp = cp - text;
++	res = wcrtomb(tmpbuf, wc, &mbs);
++	if (res > 0) {
++	    if (fwrite(tmpbuf, res, 1, f) != 1)
++		break;
 +	}
-+
-+	memmove (cp, cp + 1, strlen (cp + 1) + 1);
-     }
- }
- 
-@@ -266,8 +296,9 @@ button_new (int y, int x, int action, in
-     widget_want_hotkey (b->widget, 1);
-     b->hotkey = 0;
-     b->hotpos = -1;
-+    b->hotwc = L'\0';
- 
--    button_scan_hotkey(b);
-+    scan_hotkey(b->text, &b->hotpos, &b->hotkey, &b->hotwc);
-     return b;
- }
- 
-@@ -280,14 +311,13 @@ button_get_text (WButton *b)
- void
- button_set_text (WButton *b, const char *text)
- {
--   g_free (b->text);
-+    g_free (b->text);
-     b->text = g_strdup (text);
-     b->widget.cols = button_len (text, b->flags);
--    button_scan_hotkey(b);
-+    scan_hotkey(b->text, &b->hotpos, &b->hotkey, &b->hotwc);
-     dlg_redraw (b->widget.parent);
++    }
++#endif /* UTF8 */
+     return i;
  }
  
--
- /* Radio button widget */
- static int radio_event (Gpm_Event *event, void *);
- 
-@@ -362,14 +392,35 @@ radio_callback (Widget *w, widget_msg_t 
- 	    widget_move (&r->widget, i, 0);
- 
- 	    tty_printf ("(%c) ", (r->sel == i) ? '*' : ' ');
--	    for (cp = r->texts[i]; *cp; cp++) {
--		if (*cp == '&') {
--		    widget_selectcolor (w, focused, TRUE);
-+	    cp = strchr (r->texts[i], '&');
-+	    if (cp != NULL) {
-+#ifdef UTF8
-+		mbstate_t s;
-+		wchar_t wc;
-+		int len;
-+#endif
-+		tty_printf ("%.*s", (int) ((char *) cp - r->texts[i]),
-+			r->texts[i]);
-+		widget_selectcolor (w, focused, TRUE);
+@@ -290,12 +352,46 @@ edit_insert_file (WEdit *edit, const cha
+ 	int i, file, blocklen;
+ 	long current = edit->curs1;
+ 	unsigned char *buf;
 +#ifdef UTF8
-+		if (SLsmg_Is_Unicode) {
-+		    memset (&s, 0, sizeof (s));
-+		    len = mbrtowc (&wc, cp + 1, MB_CUR_MAX, &s);
-+		    ++cp;
-+		    if (len > 0) {
-+			tty_printf ("%.*s", len, cp);
-+			cp += len;
-+		    }
-+                } else
-+#endif
-+		{
- 		    addch (*++cp);
--		    widget_selectcolor (w, focused, FALSE);
--		} else
--		    addch (*cp);
--	    }
-+		    ++cp;
++	mbstate_t mbs;
++	int bufstart = 0;
++
++	memset (&mbs, 0, sizeof (mbs));
++#endif /* UTF8 */
+ 	if ((file = mc_open (filename, O_RDONLY | O_BINARY)) == -1)
+ 	    return 0;
+ 	buf = g_malloc (TEMP_BUF_LEN);
++#ifndef UTF8
+ 	while ((blocklen = mc_read (file, (char *) buf, TEMP_BUF_LEN)) > 0) {
+ 	    for (i = 0; i < blocklen; i++)
+ 		edit_insert (edit, buf[i]);
++#else /* UTF8 */
++	while ((blocklen = mc_read (file, (char *) buf + bufstart, TEMP_BUF_LEN - bufstart)) > 0) {
++	    blocklen += bufstart;
++	    bufstart = 0;
++	    for (i = 0; i < blocklen; ) {
++		mc_wchar_t wc;
++		int j;
++	        int size = mbrtowc(&wc, (char *)buf + i, blocklen - i, &mbs);
++		if (size == -2) { /*incomplete char*/
++		    bufstart = blocklen - i;
++		    memcpy(buf, buf+i, bufstart);
++		    i = blocklen;
++		    memset (&mbs, 0, sizeof (mbs));
 +		}
-+		widget_selectcolor (w, focused, FALSE);
-+	    } else
-+		cp = r->texts[i];
-+		addstr ((char *) cp);
- 	}
- 	return MSG_HANDLED;
- 
-@@ -408,7 +459,7 @@ radio_new (int y, int x, int count, cons
-     /* Compute the longest string */
-     max = 0;
-     for (i = 0; i < count; i++){
--	m = strlen (texts [i]);
-+	m = mbstrlen (texts [i]);
- 	if (m > max)
- 	    max = m;
-     }
-@@ -468,6 +519,11 @@ check_callback (Widget *w, widget_msg_t 
- 	if (c->hotpos >= 0) {
- 	    widget_selectcolor (w, msg == WIDGET_FOCUS, TRUE);
- 	    widget_move (&c->widget, 0, +c->hotpos + 4);
-+#ifdef UTF8
-+	    if (SLsmg_Is_Unicode)
-+		SLsmg_write_nwchars (&c->hotwc, 1);
-+	    else
++		else if (size <= 0) {
++#ifdef __STDC_ISO_10646__
++		    edit_insert (edit, BINARY_CHAR_OFFSET + (mc_wchar_t)buf[i]);
 +#endif
- 	    addch ((unsigned char) c->text[c->hotpos]);
++		    memset (&mbs, 0, sizeof (mbs));
++		    i++; /* skip broken char */
++		}
++		else {
++		    edit_insert (edit, wc);
++		    i+=size;
++		}
++	    }
++#endif /* UTF8 */
  	}
- 	return MSG_HANDLED;
-@@ -505,35 +561,20 @@ WCheck *
- check_new (int y, int x, int state, const char *text)
+ 	edit_cursor_move (edit, current - edit->curs1);
+ 	g_free (buf);
+@@ -385,7 +481,11 @@ cleanup:
+ static int
+ edit_load_file (WEdit *edit)
  {
-     WCheck *c =  g_new (WCheck, 1);
--    const char *s;
--    char *t;
--    
--    init_widget (&c->widget, y, x, 1, strlen (text),
-+
-+    init_widget (&c->widget, y, x, 1, mbstrlen (text),
- 	check_callback, check_event);
-     c->state = state ? C_BOOL : 0;
-     c->text = g_strdup (text);
-     c->hotkey = 0;
-     c->hotpos = -1;
-+    c->hotwc = L'\0';
-     widget_want_hotkey (c->widget, 1);
++#ifndef UTF8
+     int fast_load = 1;
++#else /* UTF8 */
++    int fast_load = 0; /* can't be used with multibyte characters */
++#endif /* UTF8 */
  
--    /* Scan for the hotkey */
--    for (s = text, t = c->text; *s; s++, t++){
--	if (*s != '&'){
--	    *t = *s;
--	    continue;
--	}
--	s++;
--	if (*s){
--	    c->hotkey = tolower ((unsigned char) *s);
--	    c->hotpos = t - c->text;
--	}
--	*t = *s;
--    }
--    *t = 0;
-+    scan_hotkey (c->text, &c->hotpos, &c->hotkey, &c->hotwc);
-     return c;
+     /* Cannot do fast load if a filter is used */
+     if (edit_find_filter (edit->filename) >= 0)
+@@ -451,6 +551,7 @@ edit_load_position (WEdit *edit)
+     edit->prev_col = column;
+     edit_move_to_prev_col (edit, edit_bol (edit, edit->curs1));
+     edit_move_display (edit, line - (edit->num_widget_lines / 2));
++    edit->charpoint = 0;
  }
  
--
- /* Label widget */
- 
- static cb_ret_t
-@@ -572,7 +613,7 @@ label_callback (Widget *w, widget_msg_t 
- 		}
- 		widget_move (&l->widget, y, 0);
- 		tty_printf ("%s", p);
--		xlen = l->widget.cols - strlen (p);
-+		xlen = l->widget.cols - mbstrlen (p);
- 		if (xlen > 0)
- 		    tty_printf ("%*s", xlen, " ");
- 		if (!q)
-@@ -606,7 +647,7 @@ label_set_text (WLabel *label, const cha
-     if (text){
- 	label->text = g_strdup (text);
- 	if (label->auto_adjust_cols) {
--	    newcols = strlen (text);
-+	    newcols = mbstrlen (text);
- 	    if (newcols > label->widget.cols)
- 	    label->widget.cols = newcols;
- 	}
-@@ -630,7 +671,7 @@ label_new (int y, int x, const char *tex
-     if (!text || strchr(text, '\n'))
- 	width = 1;
-     else
--	width = strlen (text);
-+	width = mbstrlen (text);
- 
-     l = g_new (WLabel, 1);
-     init_widget (&l->widget, y, x, 1, width, label_callback, NULL);
-@@ -778,13 +819,69 @@ static void draw_history_button (WInput 
- /* Pointer to killed data */
- static char *kill_buffer = 0;
- 
-+#ifdef UTF8
-+static int
-+charpos(WInput *in, int idx)
-+{
-+    int i, pos, l, len;
-+    mbstate_t mbs;
-+    memset (&mbs, 0, sizeof (mbs));
-+    i = 0;
-+    pos = 0;
-+    len = strlen(in->buffer);
<<Diff was trimmed, longer than 597 lines>>

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/mc-utf8.patch?r1=1.9&r2=1.10&f=u



More information about the pld-cvs-commit mailing list