1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +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

@ -25,6 +25,7 @@ ksh 93u+m general copyright notice
# George Lijo <george.lijo@gmail.com> #
# Govind Kamat <govind_kamat@yahoo.com> #
# Harald van Dijk <harald@gigawatt.nl> #
# K. Eugene Carlson <kvngncrlsn@gmail.com> #
# Kurtis Rader <krader@skepticism.us> #
# Lev Kujawski <int21h@mailbox.org> #
# Marc Wilson <posguy99@gmail.com> #

4
NEWS
View file

@ -8,6 +8,10 @@ Any uppercase BUG_* names are modernish shell bug IDs.
- Fixed a bug introduced on 2022-02-08 where $PPID was incorrect when a script
without a #! path was executed.
- Fixed a completion bug in the vi line editor. It now correctly completes
the sole member of a directory when tab is pressed immediately after /.
Thanks to K. Eugene Carlson for the report and the fix.
2022-07-26:
- Fixed incorrect handling of initial zeros in test/[ and [[ arithmetic

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);