vile
[Top][All Lists]
Advanced

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

Re: [vile] vile-9.6j.patch.gz


From: Thomas Dickey
Subject: Re: [vile] vile-9.6j.patch.gz
Date: Wed, 26 Mar 2008 19:17:37 -0400 (EDT)

On Wed, 26 Mar 2008, Thomas Dickey wrote:

On Wed, 26 Mar 2008, Chris G wrote:

I don't quite follow this.  Maybe I didn't explain my case right.  It
should be impossible (as I understand it) to create a file with
iso-8859-1 pound signs in it if everything is set up correctly for
utf-8 shouldn't it?  I just happened to have some iso-8859-1 pounds in
a file I had created earlier.

When I edited the file with the iso-8859-1 pound signs (just 0xA3
bytes by themselves) I got the incorrect cursor positioning. These are
invalid characters in utf-8 and, I believe, vile should really display
the 'invalid character' glyph which on my system appears to be an
inverse question mark.

I see - can reproduce it here. It looks as if vile's got confused at some point (there are a half-dozen knots in display.c which I thought were all aligned). It should show as \?A3 and track the cursor according to that 4-column width. The cursor is moving properly, but the display isn't.

This seems to fix it:

--- display.c   2008/03/06 01:10:52     1.471
+++ display.c   2008/03/26 23:06:14
@@ -732,7 +732,7 @@
     if (w_val(wp, WMDLIST)) {
        rc = vtlistc(wp, src, limit);
     } else if (b_is_utfXX(wp->w_bufp)
-              && column_sizes(wp, src, limit, &rc) == COLS_UTF8) {
+              && column_sizes(wp, src, limit, &rc) >= COLS_8BIT) {
        rc = vtlistc(wp, src, limit);
     } else {
        rc = vtputc(wp, src, limit);

Going down the third path, in vtputc it decides that the character is
really printable (since that would be true of the Unicode value, but
not the raw byte), and just stuffs it in the array that holds Unicode
values.

vtlistc is where it handles most characters other than the ASCII codes.
If it weren't in UTF-8 mode, then it might display that as \xA3.

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net




reply via email to

[Prev in Thread] Current Thread [Next in Thread]