Re: incorrect hex number in editor [patch]

2006-09-05 Thread Egmont Koblinger
Here you are. Apply it after the big utf8 patch.


-- 
Egmont
diff -Naur mc-4.6.1.orig/edit/editdraw.c mc-4.6.1/edit/editdraw.c
--- mc-4.6.1.orig/edit/editdraw.c   2006-09-05 13:14:51.0 +0200
+++ mc-4.6.1/edit/editdraw.c2006-09-05 13:42:50.0 +0200
@@ -57,12 +57,22 @@
  */
 if (edit-curs1  edit-last_byte) {
 mc_wchar_t cur_byte = edit_get_byte (edit, edit-curs1);
+mc_wchar_t cur_byte2 = cur_byte;
 #ifndef UTF8
g_snprintf (byte_str, sizeof (byte_str), %c %3d 0x%02X,
is_printable (cur_byte) ? cur_byte : '.',
 #else /* UTF8 */
+/* In 8-bit locales show the byte itself instead of its Unicode value 
*/
+if (MB_CUR_MAX == 1) {
+unsigned char cur_8bit_byte;
+mbstate_t mbs;
+memset (mbs, 0, sizeof (mbs));
+if (wcrtomb(cur_8bit_byte, cur_byte, mbs) == 1) {
+cur_byte = cur_8bit_byte;
+}
+}
 g_snprintf (byte_str, sizeof(byte_str), %lc %3d 0x%02X,
-iswprint(cur_byte) ? cur_byte : '.',
+iswprint(cur_byte2) ? cur_byte2 : '.',
 #endif /* UTF8 */
 (int) cur_byte,
 (unsigned) cur_byte);
___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: incorrect hex number in editor [patch]

2006-09-05 Thread Jindrich Novy
On Tue, 2006-09-05 at 13:47 +0200, Egmont Koblinger wrote:
 Here you are. Apply it after the big utf8 patch.
 

Ah, I see I came a bit late :) Thanks for the patch Egmont.

Jindrich
-- 
Jindrich Novy [EMAIL PROTECTED], http://people.redhat.com/jnovy/
(o_   _o)
//\  The worst evil in the world is refusal to think. //\
V_/_ _\_V


___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel