On Sat, Apr 12, 2025 at 10:57:26AM +0200, Walter Alejandro Iglesias wrote:
> On Sat, Apr 12, 2025 at 10:25:22AM +0200, Walter Alejandro Iglesias wrote:
> > In any case, if you preffer not to remove that conditional the following
> > diff also fix the first issue:
> >
> > 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 12 Apr 2025 08:06:14 -0000
> > @@ -1194,9 +1194,11 @@ domove(int argcnt, const char *cmd, int
> > if (!sub && es->cursor + 1 >= es->linelen)
> > return -1;
> > ncursor = (*cmd == 'e' ? endword : Endword)(argcnt);
> > - if (!sub)
> > - while (isu8cont((unsigned char)es->cbuf[--ncursor]))
> > + if (!sub) {
> > + while (isu8cont((unsigned char)es->cbuf[ncursor]))
> > continue;
> > + --ncursor;
> > + }
> > break;
> >
> > case 'f':
> >
> >
>
> I relized that what I did here has no sense, I just made the while()
> work as an if(). But the fact that it still solves the 'e' command
> issue and that, as far as I've tested it, it doesn't seem to break
> anything, I still wonder what that while conditional is for.
Finally I could found an issue that happens when removing that while()
conditional. When your cursor is positioned in a only one UTF-8
character word, you have to press "e" twice to move forward. That
suggests that in this case the "e" command still moves byte by byte
within the UTF-8 character. This doesn't happen with Lucas' solution.
--
Walter