mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
There are still two contexts in which the unhelpful "alias + builtin + path" completion occurs: * After the start of an empty line * After the start of a line, but before the first character To stop completion from being attempted in these contexts, a loop is added to vi.c and emacs.c that looks over the previous positions (current position inclusive) and allows the completion process to continue once it finds the first non-space character. The existing placement restrictions remain in case the cursor arrives in a negative position via a bug. Co-authored-by: Martijn Dekker <martijn@inlv.org>
This commit is contained in:
parent
9e7ecb1b17
commit
a874586fdc
3 changed files with 48 additions and 6 deletions
|
@ -1001,8 +1001,19 @@ static int escape(register Emacs_t* ep,register genchar *out,int count)
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
case '*': /* filename expansion */
|
case '*': /* filename expansion */
|
||||||
case '=': /* escape = - list all matching file names */
|
case '=': /* escape = - list all matching file names */
|
||||||
|
{
|
||||||
|
char allempty = 1;
|
||||||
|
int x;
|
||||||
ep->mark = cur;
|
ep->mark = cur;
|
||||||
if(cur<1)
|
for(x=0; x < cur; x++)
|
||||||
|
{
|
||||||
|
if(!isspace(out[x]))
|
||||||
|
{
|
||||||
|
allempty = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(cur<1 || allempty)
|
||||||
{
|
{
|
||||||
beep();
|
beep();
|
||||||
return(-1);
|
return(-1);
|
||||||
|
@ -1040,6 +1051,7 @@ static int escape(register Emacs_t* ep,register genchar *out,int count)
|
||||||
draw(ep,UPDATE);
|
draw(ep,UPDATE);
|
||||||
}
|
}
|
||||||
return(-1);
|
return(-1);
|
||||||
|
}
|
||||||
|
|
||||||
/* search back for character */
|
/* search back for character */
|
||||||
case cntl(']'): /* feature not in book */
|
case cntl(']'): /* feature not in book */
|
||||||
|
|
|
@ -1537,6 +1537,22 @@ static void getline(register Vi_t* vp,register int mode)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case '\t': /** command completion **/
|
case '\t': /** command completion **/
|
||||||
|
{
|
||||||
|
char allempty = 1;
|
||||||
|
int x;
|
||||||
|
for(x=0; x <= cur_virt; x++)
|
||||||
|
{
|
||||||
|
if(!isspace(virtual[x]))
|
||||||
|
{
|
||||||
|
allempty = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(allempty)
|
||||||
|
{
|
||||||
|
ed_ringbell();
|
||||||
|
break;
|
||||||
|
}
|
||||||
if(sh_isoption(SH_VI) &&
|
if(sh_isoption(SH_VI) &&
|
||||||
mode != SEARCH &&
|
mode != SEARCH &&
|
||||||
last_virt >= 0 &&
|
last_virt >= 0 &&
|
||||||
|
@ -1566,6 +1582,7 @@ static void getline(register Vi_t* vp,register int mode)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
fallback:
|
fallback:
|
||||||
if( mode == REPLACE )
|
if( mode == REPLACE )
|
||||||
|
@ -2545,7 +2562,18 @@ addin:
|
||||||
case '*': /** do file name expansion in place **/
|
case '*': /** do file name expansion in place **/
|
||||||
case '\\': /** do file name completion in place **/
|
case '\\': /** do file name completion in place **/
|
||||||
case '=': /** list file name expansions **/
|
case '=': /** list file name expansions **/
|
||||||
if( cur_virt == INVALID )
|
{
|
||||||
|
char allempty = 1;
|
||||||
|
int x;
|
||||||
|
for(x=0; x <= cur_virt; x++)
|
||||||
|
{
|
||||||
|
if(!isspace(virtual[x]))
|
||||||
|
{
|
||||||
|
allempty = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(cur_virt == INVALID || allempty)
|
||||||
return(BAD);
|
return(BAD);
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
save_v(vp);
|
save_v(vp);
|
||||||
|
@ -2584,6 +2612,7 @@ addin:
|
||||||
return(APPEND);
|
return(APPEND);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case '@': /** macro expansion **/
|
case '@': /** macro expansion **/
|
||||||
if( mode )
|
if( mode )
|
||||||
|
|
|
@ -4987,6 +4987,8 @@ will provide a numbered list of matching alternatives.
|
||||||
A specific selection can be made by entering the
|
A specific selection can be made by entering the
|
||||||
selection number followed by a
|
selection number followed by a
|
||||||
.IR tab .
|
.IR tab .
|
||||||
|
Neither completion nor listing operations are attempted before
|
||||||
|
the first character in a line.
|
||||||
.SS Key Bindings.
|
.SS Key Bindings.
|
||||||
The
|
The
|
||||||
.B
|
.B
|
||||||
|
@ -5581,10 +5583,9 @@ or
|
||||||
character.
|
character.
|
||||||
.TP 10
|
.TP 10
|
||||||
.BI ^I " tab"
|
.BI ^I " tab"
|
||||||
Except at the start of the line, attempts command or
|
Attempts command or file name completion as described
|
||||||
file name completion as described above and returns to
|
above and returns to input mode. If a partial completion
|
||||||
input mode. If a partial completion occurs, repeating
|
occurs, repeating this will behave as if
|
||||||
this will behave as if
|
|
||||||
.B =
|
.B =
|
||||||
were entered from control mode.
|
were entered from control mode.
|
||||||
If no match is found or entered after
|
If no match is found or entered after
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue