Re: incorrect hex number in editor

2006-09-05 Thread Nerijus Baliunas
Hello,

I updated to 4.6.1a-26.fc5 and the problem is still here.

Nerijus

On Sat, 02 Sep 2006 08:28:52 +0200 Jindrich Novy [EMAIL PROTECTED] wrote:

 Hi Nerijus,
 
 this doesn't happen in the rawhide mc-4.6.1-25.fc6 which contains the
 mc-2006-08-12-18.tar.gz snapshot. I'll sync both the versions and
 release FC5 update to fix it.
 
 Jindrich
 
 On Fri, 2006-09-01 at 02:17 +0300, Nerijus Baliunas wrote:
  Hello,
  
  attached file is 0xC3 0xBC 0xC5 0xAB (you can check with
  any hex editor or mc viewer in hex mode), but editor
  shows it (in the last column of the first line) as
  0x106 0xBC 0xC5 0xAB.
  
  Latest mc from FC5 (2006-06-30-18).
  
  Regards,
  Nerijus

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


Re: incorrect hex number in editor

2006-09-05 Thread Egmont Koblinger
On Tue, Sep 05, 2006 at 09:09:01AM +0300, Nerijus Baliunas wrote:

 I updated to 4.6.1a-26.fc5 and the problem is still here.

   attached file is 0xC3 0xBC 0xC5 0xAB (you can check with
   any hex editor or mc viewer in hex mode), but editor
   shows it (in the last column of the first line) as
   0x106 0xBC 0xC5 0xAB.
   
   Latest mc from FC5 (2006-06-30-18).

Fedora is using mc with the UTF-8 patches, and provides a full UTF-8
environment, right?

Then the file you described above should display as 2 characters, a
LATIN SMALL LETTER U WITH DIAERESIS
followed by a
LATIN SMALL LETTER U WITH MACRON

Hence the expected hex codes in the upper right corner of mcedit are
0xFC and 0x16B. This is different from what you expect, and different from
what you see, too.

mcedit is a text editor, whereas the word text nowadays usually refers to
UTF-8 encoding. Hence with the UTF-8 mc patches it is no longer a binary/hex
editor.

Or am I wrong?


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


Re: incorrect hex number in editor

2006-09-05 Thread Nerijus Baliunas
On Tue, 5 Sep 2006 12:18:54 +0200 Egmont Koblinger [EMAIL PROTECTED] wrote:

 Fedora is using mc with the UTF-8 patches, and provides a full UTF-8
 environment, right?
 
 Then the file you described above should display as 2 characters, a
 LATIN SMALL LETTER U WITH DIAERESIS
 followed by a
 LATIN SMALL LETTER U WITH MACRON

Yes, in UTF-8 it's correct.

 Hence the expected hex codes in the upper right corner of mcedit are
 0xFC and 0x16B. This is different from what you expect, and different from
 what you see, too.
 
 mcedit is a text editor, whereas the word text nowadays usually refers to
 UTF-8 encoding. Hence with the UTF-8 mc patches it is no longer a binary/hex
 editor.

But it should either show correct hex codes or correct UTF-8 letters, which it
does not. BTW, I am not using UTF-8 locale.

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


Re: incorrect hex number in editor

2006-09-05 Thread Egmont Koblinger
On Tue, Sep 05, 2006 at 01:33:17PM +0300, Nerijus Baliunas wrote:

 But it should either show correct hex codes or correct UTF-8 letters, which it
 does not.

Yes, perfectly right.

 BTW, I am not using UTF-8 locale.

Now I'm playing with my mc (not Fedora, but most likely nearly the same
UTF-8 patches) in non-UTF-8 mode.

With the hu_HU locale (iso-8859-2) I get: 0x102, 0x17A, 0x139, 0x164.
With en_US the hex codes displayed are: 0xC3 0xBC 0xC5 0xAB.
The later one is perfect, the first one is faulty.
With C locale you get: 0xFFEC3, 0xFFEBC, 0xFFEC5, 0xFFEAB.

So you're right, there's a bug somewhere in the UTF-8 patch, and its
behaviour depends on the exact locale. What locale do you have? Does it work
perfectly for you with an iso-8859-1 locale?


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


Re: incorrect hex number in editor

2006-09-05 Thread Nerijus Baliunas
On Tue, 5 Sep 2006 12:56:34 +0200 Egmont Koblinger [EMAIL PROTECTED] wrote:

 Now I'm playing with my mc (not Fedora, but most likely nearly the same
 UTF-8 patches) in non-UTF-8 mode.
 
 With the hu_HU locale (iso-8859-2) I get: 0x102, 0x17A, 0x139, 0x164.
 With en_US the hex codes displayed are: 0xC3 0xBC 0xC5 0xAB.
 The later one is perfect, the first one is faulty.
 With C locale you get: 0xFFEC3, 0xFFEBC, 0xFFEC5, 0xFFEAB.
 
 So you're right, there's a bug somewhere in the UTF-8 patch, and its
 behaviour depends on the exact locale. What locale do you have?

lt_LT.ISO8859-13

 Does it work
 perfectly for you with an iso-8859-1 locale?

Yes, with en_US.ISO-8859-1 it shows correct hex codes.

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


Re: incorrect hex number in editor

2006-09-05 Thread Egmont Koblinger
 With the hu_HU locale (iso-8859-2) I get: 0x102, 0x17A, 0x139, 0x164.
 With en_US the hex codes displayed are: 0xC3 0xBC 0xC5 0xAB.

Okay, got it: these are the Unicode codes of the symbols that are actually
displayed. In other words: the byte over which your cursor stands is
converted from the current locale to UCS and this value is displayed.

I guess that the reason is the following: The current method could be simply
implemented with one single codebase without branches that works for all
locales. (Take the byte(s) which form the symbol you're standing over,
convert from the current locale to UCS4 and display this code).

The behaviour you'd expect would need different code for the two cases:
detect whether the locale is 8-bit or not, do the conversion if it's not,
but don't convert if it is 8-bit. It'd be tougher and less straight-forward
and less logical from a programmer's view. However, this might be the
behavior an average user prefers.

I'll take a quick look at the code to see if I can patch it.


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


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

2006-09-05 Thread Jindrich Novy
On Tue, 2006-09-05 at 13:33 +0300, Nerijus Baliunas wrote:
 But it should either show correct hex codes or correct UTF-8 letters, which it
 does not. BTW, I am not using UTF-8 locale.

This is quite important since I assume that you use UTF-8 locale which
is default in Fedora. In that case I understand I was unable to
reproduce your problem. Which locale do you use?

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


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


Re: Mouse support bugs and a couple of feature requests (fwd)

2006-09-05 Thread Stephan Sokolow
On Monday September 4, 2006 08:57, Pavel Tsekov wrote:

 Screen uses a pseudo-terminal pair to communicate with the shells it
 starts. As such when you start MC it is running on the pseudo terminal
 slave device - /dev/pts/1 for example. It is screen that is running on
 the virtual console device (the real terminal) and not MC. gpm cannot
 handle mouse events on anything other than Linux virtual console. So
 requests from MC for mouse events on /dev/pts/1 should fail ... but
 there is a patch in the RedHat version of gpm that removes a check which
 is supposed to catch that condition. I guess you are using Fedora, right ?

Gentoo, actually.

-- 
deitarion/SSokolow
Stephan Sokolow
SSokolow.com Webmaster
___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel