On Fri, Jul 29, 2022 at 04:27:05AM -0400, Thomas Dickey wrote:
> On Fri, Jul 29, 2022 at 03:40:12PM +1000, Brendan O'Dea wrote:
> > Testing the vile 9.8v-2 package on my Debian machine I get some decidedly
> > odd behaviour:
> > 
> > The following sequence:
> > 
> >   <Compose>l- <Compose>e' <Compose>c,
> > 
> > is rendered in vile as:
> > 
> >   \?A3\?E9\?E7
> > 
> > outside of vile, in the same terminal that appears fine:
> > 
> >   £éç
> > 
> > which would suggest that vile doesn't handle UTF-8 at all, although as
> > Chris noted, entering those three characters using C-v x <hex> works fine,
> > and renders in vile correctly.
> 
> hmm - with some time, I can bisect to pinpoint the problem.

did that.  It's a small change, which I'll have to rethink.
Attaching a diff showing what I changed to get this problem.

-- 
Thomas E. Dickey <dic...@invisible-island.net>
https://invisible-island.net
ftp://ftp.invisible-island.net
Index: CHANGES
--- vile/CHANGES	2020-09-09 00:17:55.000000000 +0000
+++ vile-bad/CHANGES	2020-11-30 00:56:48.000000000 +0000
@@ -1,9 +1,11 @@
 Changes for vile 9.9 (released ??? ??? ?? ????)
 
- 20200908 (v)
+ 20201129 (v)
  	> Stephan Schulz:
 	+ add popup-choices mode (Savannah #58999)
 	> Tom Dickey:
+	+ modify lins_chars() to handle a case where a script inserts a UTF-8
+	  character (report by Thomas Dupond).
 	+ modify configure/makefiles to support ".PHONY" feature.
 	+ change configure/makefiles to use ARFLAGS rather than AR_OPTS
 	+ change configure --with-warnings to --enable-warnings for consistency
Index: estruct.h
Prereq:  1.757 
--- vile/estruct.h	2020-08-23 19:03:03.000000000 +0000
+++ vile-bad/estruct.h	2020-11-29 22:41:44.000000000 +0000
@@ -12,7 +12,7 @@
 */
 
 /*
- * $Id: estruct.h,v 1.757 2020/08/23 19:03:03 Stephan.Schulz Exp $
+ * $Id: estruct.h,v 1.758 2020/11/29 22:41:44 tom Exp $
  */
 
 #ifndef _estruct_h
@@ -1316,10 +1316,14 @@
  * True if the buffer contents are in UTF-8 (or -16, -32).
  */
 #if OPT_MULTIBYTE
+#define global_is_utfXX()    ((global_b_val(VAL_FILE_ENCODING) >= enc_UTF8) \
+			   || (global_b_val(VAL_FILE_ENCODING) == enc_LOCALE \
+			    && vl_encoding >= enc_UTF8))
 #define b_is_utfXX(bp)       ((b_val(bp, VAL_FILE_ENCODING) >= enc_UTF8) \
 			   || (b_val(bp, VAL_FILE_ENCODING) == enc_LOCALE \
 			    && vl_encoding >= enc_UTF8))
 #else
+#define global_is_utfXX()    0
 #define b_is_utfXX(bp)       0
 #endif
 
Index: insert.c
Prereq:  1.184 
--- vile/insert.c	2015-03-13 10:29:15.000000000 +0000
+++ vile-bad/insert.c	2020-11-29 22:44:16.000000000 +0000
@@ -4,7 +4,7 @@
  * Most code probably by Dan Lawrence or Dave Conroy for MicroEMACS
  * Extensions for vile by Paul Fox
  *
- * $Header: /tmp/vile/RCS/insert.c,v 1.184 2015/03/13 10:29:15 tom Exp $
+ * $Header: /tmp/vile/RCS/insert.c,v 1.185 2020/11/29 22:44:16 tom Exp $
  */
 
 #include	"estruct.h"
@@ -1039,7 +1039,7 @@
 	while (n--) {
 	    tp = tstring;
 	    while (*tp) {
-		if ((status = inschar(*tp++, &backsp_limit)) != TRUE) {
+		if ((status = inschar(CharOf(*tp++), &backsp_limit)) != TRUE) {
 		    n = 0;
 		    break;
 		}
Index: line.c
Prereq:  1.235 
--- vile/line.c	2019-12-19 09:32:10.000000000 +0000
+++ vile-bad/line.c	2020-11-30 00:46:44.000000000 +0000
@@ -10,7 +10,7 @@
  * editing must be being displayed, which means that "b_nwnd" is non zero,
  * which means that the dot and mark values in the buffer headers are nonsense.
  *
- * $Id: line.c,v 1.235 2019/12/19 09:32:10 bod Exp $
+ * $Id: line.c,v 1.236 2020/11/30 00:46:44 tom Exp $
  */
 
 /* #define POISON */
@@ -542,7 +542,7 @@
     int nn;
     int mapped;
 
-    if ((c > 127) && b_is_utfXX(curbp)) {
+    if (!global_is_utfXX() && (c > 127) && b_is_utfXX(curbp)) {
 	nbytes = vl_conv_to_utf8(target, (UINT) c, sizeof(target));
     } else if (okCTYPE2(vl_wide_enc) && !vl_mb_is_8bit(c)) {
 	nbytes = 1;

Attachment: signature.asc
Description: PGP signature

Reply via email to