On Mon, Jan 02, 2023 at 08:33:05PM -0500, Thomas Dickey wrote:
> On Mon, Jan 02, 2023 at 03:27:20PM -0500, Thomas Dickey wrote:
> > On Mon, Jan 02, 2023 at 11:23:54AM +0000, Chris Green wrote:
> > > So, after partially understanding the syntax highlighting issue I now
> > > see that entering accented characters is still broken.
> > > 
> > > As reported a while ago vile 9.8v gets confused when you try to enter
> > > accented characters (I use a Multi_key, so to enter, for example an e
> > > with an acute accent I hit Multi_key, e, ').
> > > 
> > > On vile 9.8u (and earlier, I've checked 9.8t too) entering accented
> > > characters with the Multi_key works perfectly.  On 9.8v (as reported)
> > > on entering an accented character an odd backslash sequence is echoed
> > > and it's not the character entered.
> > > 
> > > On vile 9.8w (from the Ubuntu repository) entering an accented
> > > character does nothing if you enter just one accented character but if
> > > you enter a second accented character that *does* get added.  This
> > > continues, entering a series of accented characters every other one
> > > actually gets inserted.
> 
> fwiw, this was introduced at the time that I fixed this bug:
>  
>  20220805 (w)
>       + revise change for lins_chars() to handle UTF-8 in scripts, as that
>         interfered with normal insertions (report by Chris Green).
> 
> and the "odd backslash" was from an earlier change to the same code:
> 
>       + modify lins_chars() to handle a case where a script inserts a UTF-8
>         character (report by Thomas Dupond).
> 
> I think I'll have time later this week to re-revisit this (and make both
> scripts and interactive editing work at the same time).

see attached (9.8y will have other changes, but this is the small fix)

-- 
Thomas E. Dickey <dic...@invisible-island.net>
https://invisible-island.net
--- vile-9.8x+/map.c	2022-12-23 00:32:02.000000000 +0000
+++ vile-9.8y/map.c	2023-01-13 08:51:24.000000000 +0000
@@ -923,6 +926,18 @@
     }
 
     do {
+	/*
+	 * This is a workaround for an ambiguity between the different return
+	 * values from mapgetc(), on entry to this function:
+	 * - If infloopcount is zero, mapgetc() has just called tgetc(), which
+	 *   in turn called sysmapped_c(), and then term.getc().  That pointer
+	 *   is initialized to vl_mb_getch(), which will decode UTF-8 into a
+	 *   Unicode value.
+	 * - If infloopcount is nonzero, the function returns a byte (of UTF-8),
+	 *   which must be decoded later in this function.
+	 */
+	int full_c = (infloopcount == 0);	/* tgetc returned full char? */
+
 	(void) itb_init(&mappedchars, esc_c);
 
 	matched = maplookup(c,
@@ -949,7 +966,7 @@
 
 	c = mapgetc();
 #if OPT_MULTIBYTE
-	if (vl_encoding >= enc_UTF8 && b_is_utfXX(curbp)) {
+	if (remap && !full_c && (vl_encoding >= enc_UTF8 && b_is_utfXX(curbp))) {
 	    char save[MAX_UTF8];
 	    int have = 0;
 	    int need = 9;

Attachment: signature.asc
Description: PGP signature

Reply via email to