1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

vi mode completion: use APPEND when e_nlist is 0 (#493)

Attempting to tab-complete the only member of a directory while in
vi mode switches to "control" under the following conditions:

 1. pwd is outside of the directory

 2. No part of the basename has been typed in (e.g., starting with
    vim TEST/t will autocomplete to vim TEST/test, but starting
    with vim TEST/ will not).

Also, trying to type with "input" or "replace" fails afterwards
until a new line has been generated (either with ctrl + c or the
j/k keys in control mode).

src/cmd/ksh93/edit/vi.c: textmod():
- The strange completion behavior in vi mode for single-member
  directories appears to be at least partially due to completion
  failing to use \ or * mode from outside of pwd. Checking for
  e_nlist directly from vi.c — 0 unless in = mode — allows for
  entering the else loop at line 2575 to reach APPEND mode.

Resolves: https://github.com/ksh93/ksh/issues/485
This commit is contained in:
pghvlaans 2022-07-28 06:33:44 +09:00 committed by Martijn Dekker
parent 1a0d75d47c
commit 3be94a7fd4
3 changed files with 6 additions and 1 deletions

View file

@ -2566,7 +2566,7 @@ addin:
last_virt = i;
ed_ringbell();
}
else if((c=='=' || (c=='\\'&&virtual[last_virt]=='/')) && !vp->repeat_set)
else if(vp->ed->e_nlist!=0 && !vp->repeat_set)
{
last_virt = i;
vi_redraw((void*)vp);