On Sat, Apr 05, 2025 at 10:42:11AM +0000, Lucas Gabriel Vuotto wrote: > On Sat, Apr 05, 2025 at 11:33:31AM +0200, Walter Alejandro Iglesias wrote: > > On Sat, Apr 05, 2025 at 08:57:51AM +0000, Lucas Gabriel Vuotto wrote: > > > On Sat, Apr 05, 2025 at 09:36:07AM +0200, Walter Alejandro Iglesias wrote: > > > > Hi again Lucas, > > > > > > > > This time I paid a little more attention :-). Maybe I'm missing > > > > something, but it seems to me that, in your patch, the skip_utf8_cont > > > > variable is unnecessary. > > > > > > > > Anyway, at first I'd also tried doing something similar to what you > > > > suggested, I still think it doesn't require so much fuss. Let's see if > > > > I don't make any stupid mistakes with this new version of mine: > > > > > > anton pointed the same out in a private email and also requested > > > regress modifications. The current patch is > > > > > > > I don't want to waste your time giving me C lessons, but if it's not too > > long to explain, I would appreciate it if Anton, you or anyone else > > could tell me what the problem (regression?) could be with just removing > > the conditional, as I did in my last example: > > domove is an internal function to vi.c, called exclusively by vi_cmd. > It either calls it with the last param (sub) set to either 0 or 1. I > believe one way you can run into the latter is by doing `ye`, for > example, which is valid command (copy from cursor to end of word) that > isn't a move command straight off the bat. I believe that, without the > conditional, the `e` in `ye` will move the cursor, thing that shouldn't > happen. >
That doesn't happen. One thing I observed that happen after removing the conditional is that when you paste the yanked text, the last byte of the last UTF-8 character is eaten. The following solves that: Index: vi.c =================================================================== RCS file: /cvs/src/bin/ksh/vi.c,v diff -u -p -r1.60 vi.c --- vi.c 12 Mar 2021 02:10:25 -0000 1.60 +++ vi.c 5 Apr 2025 11:19:57 -0000 @@ -1195,8 +1195,7 @@ domove(int argcnt, const char *cmd, int return -1; ncursor = (*cmd == 'e' ? endword : Endword)(argcnt); if (!sub) - while (isu8cont((unsigned char)es->cbuf[--ncursor])) - continue; + isu8cont((unsigned char)es->cbuf[--ncursor]); break; case 'f': I discovered another issue (in the unpatched ksh). Given for example: $ word €€€ word €€€ If you yank the first €€€ (with `ye`), then put your cursor in the last character (the last € of the last word) and paste the text (hitting `p`), the string gets corrupted. Well, it seems that ksh vi mode UTF-8 support needs a lot of work. :-) -- Walter