> > On Sat, Apr 05, 2025 at 01:33:10PM +0200, Walter Alejandro Iglesias wrote: > > > 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. > > > > > > > The following diff corrects both issues, the original and the explained > > above: > >
Please excuse me if I'm a bit chaotic. I don't do this every day; I have trouble understanding the code at first. This seems to work: 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 11 Apr 2025 09:59:40 -0000 @@ -834,8 +834,12 @@ vi_cmd(int argcnt, const char *cmd) case 'p': modified = 1; hnum = hlast; - if (es->linelen != 0) + if (es->linelen != 0) { es->cursor++; + while (!isascii(es->cbuf[es->cursor]) && + es->cursor < es->linelen) + es->cursor++; + } while (putbuf(ybuf, yanklen, 0) == 0 && --argcnt > 0) ; if (es->cursor != 0) @@ -1195,8 +1199,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; + --ncursor; break; case 'f': -- Walter