mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Do not disable completion along with pathname expansion
The -f/--noglob shell option is documented simply as: "Disables pathname expansion." But after 'set -f' on an interactive shell, command completion and file name completion also stop working. This is because they internally use the pathname expansion mechanism. But it is not documented anywhere that 'set -f' disables completion; it's just a side effect of an implementation detail. Though ksh has always acted like this, I think it should change because it's not useful or expected behaviour. Other shells like bash, yash or zsh don't act like this. src/cmd/ksh93/sh/expand.c, src/cmd/ksh93/sh/macro.c: - Allow the SH_COMPLETE (command completion) or SH_FCOMPLETE (file name completion) state bit to override SH_NOGLOB in path_generate() and in sh_macexpand().
This commit is contained in:
parent
4fee9d84fe
commit
56c0c24b55
4 changed files with 10 additions and 4 deletions
3
NEWS
3
NEWS
|
@ -5,6 +5,9 @@ Any uppercase BUG_* names are modernish shell bug IDs.
|
|||
|
||||
2022-02-11:
|
||||
|
||||
- On the interactive shell, tab/esc completion is no longer disabled as a side
|
||||
effect of turning off pathname expansion with 'set -f' or 'set -o noglob'.
|
||||
|
||||
- Fixed a bug in which a >&- or <&- redirection could persist past a
|
||||
subshell in certain corner cases involving 'exec' or 'redirect'.
|
||||
|
||||
|
|
|
@ -284,7 +284,7 @@ again:
|
|||
for(; ap; ap=apin)
|
||||
{
|
||||
apin = ap->argchn.ap;
|
||||
if(!sh_isoption(SH_NOGLOB))
|
||||
if(!sh_isoption(SH_NOGLOB) || sh_isstate(SH_COMPLETE) || sh_isstate(SH_FCOMPLETE))
|
||||
brace=path_expand(ap->argval,arghead);
|
||||
else
|
||||
{
|
||||
|
|
|
@ -212,7 +212,7 @@ int sh_macexpand(register struct argnod *argp, struct argnod **arghead,int flag)
|
|||
mp->arith = ((flag&ARG_ARITH)!=0);
|
||||
mp->split = !(flag&ARG_ASSIGN);
|
||||
mp->assign = !mp->split;
|
||||
mp->pattern = mp->split && !(flag&ARG_NOGLOB) && !sh_isoption(SH_NOGLOB);
|
||||
mp->pattern = mp->split && !(flag&ARG_NOGLOB) && (!sh_isoption(SH_NOGLOB) || sh_isstate(SH_COMPLETE) || sh_isstate(SH_FCOMPLETE));
|
||||
mp->arrayok = mp->arith || (flag&ARG_ARRAYOK);
|
||||
str = argp->argval;
|
||||
fcsopen(str);
|
||||
|
|
|
@ -952,13 +952,16 @@ w exit
|
|||
|
||||
touch "$tmp/foo bar"
|
||||
((SHOPT_VSH || SHOPT_ESH)) && tst $LINENO <<!
|
||||
L tab completion with space in string
|
||||
L tab completion with space in string and -o noglob on
|
||||
# https://github.com/ksh93/ksh/pull/413
|
||||
# Amended to test that completion keeps working after -o noglob
|
||||
|
||||
d 15
|
||||
p :test-1:
|
||||
w set -o noglob
|
||||
p :test-2:
|
||||
w echo $tmp/foo\\\\ \\t
|
||||
r ^:test-1: echo $tmp/foo\\\\ bar \\r\\n$
|
||||
r ^:test-2: echo $tmp/foo\\\\ bar \\r\\n$
|
||||
r ^$tmp/foo bar\\r\\n$
|
||||
!
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue