* PATCH: Re: blah*[TAB] (difference between 3.1.6 and 3.1.9)
@ 2000-06-08 7:18 Sven Wischnowsky
0 siblings, 0 replies; 4+ messages in thread
From: Sven Wischnowsky @ 2000-06-08 7:18 UTC (permalink / raw)
To: zsh-workers
Bart Schaefer wrote:
> On Jun 7, 8:49am, Sven Wischnowsky wrote:
> } Subject: Re: blah*[TAB] (difference between 3.1.6 and 3.1.9)
> }
> } I wrote:
> }
> } > Bart Schaefer wrote:
> } >
> } > > Something's definitely gone wrong with expand-or-complete. This was not
> } > > intentional.
> } >
> } > Ahem. Changed in 9777 in reply to 9756 (guess the author).
> } >
> } > 9777 commented out some stuff in doexpansion(). Change it back?
> }
> } I want to get that from my todo-list. Should we change it back? Bart
> } (9765 was from you)?
>
> Sorry, I couldn't make up my mind yesterday.
>
> In 9777 you wrote:
> > About the space: this was obviously intentional, too. I've just
> > changed the test in doexpansion() so we can go back easily if suddenly
> > we decide the old behaviour was better. But what I would really like
> > to have is a better test: when do we want the space and when not.
>
> I think it should add the space only when the expansion results in more
> than one word being inserted. The reasoning is that it probably doesn't
> make sense to continue completing only the last of several words that
> were generated from the same pattern, but if only one word resulted then
> it might reasonably be a prefix of a longer completion.
Sounds sensible.
> The potential issue I see with this is that what a lot of people want is
> really expand-AND-complete (not "or"), which makes them think a space
> should be appended if the result is an existing plain file, or something
> like that. In fact, I used to be one of them; for a long time I had
> "setopt recexact" just so that two tabs would expand and then insert a
> space rather than expand and then produce a listing (when one file name
> is a prefix of another). I've since come to the conclusion that recexact
> is almost always more trouble than it is worth. However, that doesn't
> help resolve this ... perhaps another style?
I don't want to make old completion code use styles, I think (and
somehow I seem to want to avoid using styles in C-code, in the hope
that one day we'll find a way to more-or-less automatically find used
styles).
Bye
Sven
Index: Src/Zle/zle_tricky.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_tricky.c,v
retrieving revision 1.13
diff -u -r1.13 zle_tricky.c
--- Src/Zle/zle_tricky.c 2000/06/07 08:39:57 1.13
+++ Src/Zle/zle_tricky.c 2000/06/08 07:15:54
@@ -1627,7 +1627,7 @@
static int
doexpansion(char *s, int lst, int olst, int explincmd)
{
- int ret = 1;
+ int ret = 1, first = 1;
LinkList vl;
char *ss;
@@ -1678,10 +1678,11 @@
if (olst != COMP_EXPAND_COMPLETE || nonempty(vl) ||
(cs && line[cs-1] != '/')) {
#endif
- if (nonempty(vl)) {
+ if (nonempty(vl) || !first) {
spaceinline(1);
line[cs++] = ' ';
}
+ first = 0;
}
end:
popheap();
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 4+ messages in thread
* PATCH: Re: blah*[TAB] (difference between 3.1.6 and 3.1.9)
@ 2000-06-06 12:58 Sven Wischnowsky
2000-06-06 15:57 ` Bart Schaefer
0 siblings, 1 reply; 4+ messages in thread
From: Sven Wischnowsky @ 2000-06-06 12:58 UTC (permalink / raw)
To: zsh-workers; +Cc: Vincent Lefevre
[ moved to -workers and CC'ed to Vincent ]
Vincent Lefevre wrote:
> On Tue, Jun 06, 2000 at 03:20:38 +0000, Bart Schaefer wrote:
> > As a workaround, the following should behave the way you want:
> >
> > bindkey '\t' complete-word
> > autoload -U compinit
> > compinit
> > zstyle ':completion:*' completer _expand _complete
> > zstyle ':completion:*:expand:::' glob 1
> > zstyle ':completion:*:expand:::' substitute 1
> >
> > If you have some customized compctl commands, you may also want:
> >
> > zstyle ':completion:*' use-compctl 1
>
> If I use this (at the end of my .zshrc), variable names completion
> doesn't work any longer. For instance, I type "echo $ZSH_V":
>
> Et encore? echo $ZSH_V
>
> then [TAB], and I get:
>
> Et encore? echo #
> $ZSH_V
>
> where '#' represents the cursor.
The _expand completer offers you the expansion of $ZSH_V (an empty
string) and the original and enters menu-completion so that you can
toggle between the two (with the `expansion' being inserted in the
line immediately).
Hm, maybe we shouldn't use `empty' expansions.
And if I'm not completely mistaken, that test for add-space should eb
the other way round.
And to get nearer to the expand-or-complete behaviour, you should also
use:
zstyle ':completion:*:expand:*' tag-order all-expansions
That will make it insert only all the expansions in the line, not
allowing you to menu between the original string, the expansions
one-by-one and all expansions at once.
Bye
Sven
Index: Completion/Core/_expand
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_expand,v
retrieving revision 1.13
diff -u -r1.13 _expand
--- Completion/Core/_expand 2000/05/31 09:38:26 1.13
+++ Completion/Core/_expand 2000/06/06 12:51:44
@@ -54,7 +54,7 @@
# If the array is empty, store the original string again.
-(( $#exp )) || exp=("$word")
+[[ -z "$exp" ]] && exp=("$word")
subd=("$exp[@]")
@@ -92,7 +92,7 @@
if (( $#exp == 1 )); then
if [[ -d $exp && "$exp[1]" != */ ]]; then
suf=/
- elif zstyle -T ":completion:${curcontext}:" add-space; then
+ elif ! zstyle -T ":completion:${curcontext}:" add-space; then
suf=
fi
fi
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: PATCH: Re: blah*[TAB] (difference between 3.1.6 and 3.1.9)
2000-06-06 12:58 Sven Wischnowsky
@ 2000-06-06 15:57 ` Bart Schaefer
2000-06-06 16:44 ` Bart Schaefer
0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2000-06-06 15:57 UTC (permalink / raw)
To: zsh-workers; +Cc: Vincent Lefevre
On Jun 6, 2:58pm, Sven Wischnowsky wrote:
} Subject: PATCH: Re: blah*[TAB] (difference between 3.1.6 and 3.1.9)
}
} > > bindkey '\t' complete-word
} > > autoload -U compinit
} > > compinit
} > > zstyle ':completion:*' completer _expand _complete
} > > zstyle ':completion:*:expand:::' glob 1
} > > zstyle ':completion:*:expand:::' substitute 1
}
} And to get nearer to the expand-or-complete behaviour, you should also
} use:
}
} zstyle ':completion:*:expand:*' tag-order all-expansions
}
} That will make it insert only all the expansions in the line, not
} allowing you to menu between the original string, the expansions
} one-by-one and all expansions at once.
Eh? I just tried (again) my sequence in `zsh-3.1.9 -f' and I don't get
offered a menu. I just get the expansion inserted. I get exactly the
same behavior with your tag-order style as without.
And if your tag-order were going to matter, shouldn't it need to be:
zstyle ':completion:*:expand:*' tag-order - all-expansions
because
If any string in the value consists of only a hyphen, then
*only* the tags specified by the other strings in the value
are generated. Normally all tags not explicitly selected are
tried last if the specified tags fail to generate any
matches. This means that a value consisting only of a single
hyphen turns off completion.
} The _expand completer offers you the expansion of $ZSH_V (an empty
} string) and the original and enters menu-completion so that you can
} toggle between the two (with the `expansion' being inserted in the
} line immediately).
}
} Hm, maybe we shouldn't use `empty' expansions.
That would be consistent with previous version's behavior and with the
behavior of expand-or-complete.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: PATCH: Re: blah*[TAB] (difference between 3.1.6 and 3.1.9)
2000-06-06 15:57 ` Bart Schaefer
@ 2000-06-06 16:44 ` Bart Schaefer
0 siblings, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2000-06-06 16:44 UTC (permalink / raw)
To: zsh-workers
On Jun 6, 3:57pm, Bart Schaefer wrote:
} Subject: Re: PATCH: Re: blah*[TAB] (difference between 3.1.6 and 3.1.9)
}
} On Jun 6, 2:58pm, Sven Wischnowsky wrote:
} } Subject: PATCH: Re: blah*[TAB] (difference between 3.1.6 and 3.1.9)
} }
} } And to get nearer to the expand-or-complete behaviour, you should also
} } use:
} }
} } zstyle ':completion:*:expand:*' tag-order all-expansions
}
} Eh? I just tried (again) my sequence in `zsh-3.1.9 -f' and I don't get
} offered a menu. I just get the expansion inserted. I get exactly the
} same behavior with your tag-order style as without.
I'm sorry; I was trying zsh-3.1.7 -f ... it behaves as Sven says in 3.1.9,
though I don't understand why they differ.
And this part still puzzles me:
} And if your tag-order were going to matter, shouldn't it need to be:
}
} zstyle ':completion:*:expand:*' tag-order - all-expansions
}
} because
} If any string in the value consists of only a hyphen, then
} *only* the tags specified by the other strings in the value
} are generated. Normally all tags not explicitly selected are
} tried last if the specified tags fail to generate any
} matches.
Is that doc excerpt wrong now?
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2000-06-08 7:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-08 7:18 PATCH: Re: blah*[TAB] (difference between 3.1.6 and 3.1.9) Sven Wischnowsky
-- strict thread matches above, loose matches on Subject: below --
2000-06-06 12:58 Sven Wischnowsky
2000-06-06 15:57 ` Bart Schaefer
2000-06-06 16:44 ` Bart Schaefer
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).