zsh-workers
 help / color / mirror / code / Atom feed
* [BUG REPORT] Nonsensical behavior in response to Tab key
@ 2022-11-10 14:55 php fan
  2022-11-10 15:21 ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: php fan @ 2022-11-10 14:55 UTC (permalink / raw)
  To: zsh-workers

Hello,

I recently started using Manjaro KDE edition and it comes by default
with zsh, as opposed to bash which I was used to from other
distributions.

Often, when I write commands whose arguments are paths in the
filesystem, I'll type the first characters of a file or folder name
and hit tab to either have it autocompleted or see the list of files
and/or folders that start with that substring.

And often, in that situation, I get behavior that differs
significantly from other shells. I understand that I have a bias
towards considering the behavior I'm used to "right" and anything new
(zsh's behavior) "wrong", but in most cases I can't understand the
rationale behind zsh's behavior and I'm pretty sure that in many cases
it's plain wrong.

In this report I'll describe one particular case that simply can't be
right. I'll be happy to be proven wrong (well not really, but please
do).

1) I am inside a directory that contains the following two directories:

    AddonsLab_LinkBack
    AddonsLab_LinkChecker

plus many others with names starting with "AddonsLab_"

2) I start typing "cd Addons" and hit the Tab key

As expected that gets partially autocompleted until "cd AddonsLab_" and stops

3) I continue typing until I have "cd AddonsLab_Link" and I hit Tab again

EXPECTED:
it should show me the list of files and folders whose name starts with
"AddonsLab_Link", which are the two listed above.

OBSERVED:
1) It partially autocompletes to "cd AddonsLab_Linkc" ending with a
lowercase "c". That makes no sense whatsoever.
There were two folders that matched "AddonsLab_Link", and it didn't
show me the two options. It's like it has already decided to pick
AddonsLab_LinkChecker (wrong, should let me choose), but instead of
autocompleting it completely, it stops after the C, which it also for
some reason changes to lowercase. There's no directory (or file for
that matter) that starts with "AddonsLab_Linkc", and the only one that
starts with "AddonsLab_LinkC".

I could understand this behavior if both the following were true:
- the folder AddonsLab_LinkBack didn't exist (nor any other starting
with AddonsLab_Link not followed by a 'C' or 'c')
- besides AddonsLab_LinkChecker there was at least one folder starting
with AddonsLab_Linkc with a lowercase 'c'

Being a little more tolerant, I could understand the behavior
replacing the second condition with "besides AddonsLab_LinkChecker
there was at least one other folder starting with 'AddonsLab_LinkC'
with an uppercase or lowercase 'C'".

But none of that is the case.

2) Then if I hit Tab again, it autocompletes "cd
AddonsLab_LinkChecker". This second part makes sense given the
previous one which didn't.

I can reproduce all of the above starting with an empty folder:

Run the following sequence of commands:

> mkdir testzshbug
> cd testzshbug
> mkdir AddonsLab_whatever
> mkdir AddonsLab_LinkBack
> mkdir AddonsLab_LinkChecker

Then type "cd AddonsLab_Link" and hit Tab.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [BUG REPORT] Nonsensical behavior in response to Tab key
  2022-11-10 14:55 [BUG REPORT] Nonsensical behavior in response to Tab key php fan
@ 2022-11-10 15:21 ` Peter Stephenson
  2022-11-10 15:58   ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2022-11-10 15:21 UTC (permalink / raw)
  To: php fan, zsh-workers

This is by no means all that could be said, but just to
get started...

BTW this is more of a zsh-users topic at this point and
there could well be people not on zsh-workers that have
some usage tips.

On 10/11/2022 14:55 php fan <php4fan@gmail.com> wrote:
> And often, in that situation, I get behavior that differs
> significantly from other shells. I understand that I have a bias
> towards considering the behavior I'm used to "right" and anything new
> (zsh's behavior) "wrong", but in most cases I can't understand the
> rationale behind zsh's behavior and I'm pretty sure that in many cases
> it's plain wrong.

Zsh is highly configurable and you'll need to understand the possibilities
and how to set it up closest to the way you want before going further
down this road.

I guess you're using some vanilla configuration, but you should certainly
make sure whatever is going on it's running "compinit", or you'll get
the old builtin behaviour, which is certainly not recommended.  See
below if this currently means nothing to you.

Apart from the shell options in the shell documentation (a pretty
dense read), you could look at the (somewhat dated --- it's many years
since I touched it --- but still mostly valid) online user guide,

https://zsh.sourceforge.io/Guide/zshguide06.html

See further down in section 6.3 if the reference to "compinit" meant nothing.

For a more professional production, see Oliver's notes in the From Bash
To Zsh book, available everywhere browsers are connected to booksellers.
https://www.bash2zsh.com

> 1) I am inside a directory that contains the following two directories:
> 
>     AddonsLab_LinkBack
>     AddonsLab_LinkChecker
> 
> plus many others with names starting with "AddonsLab_"
> 
> 2) I start typing "cd Addons" and hit the Tab key
> 
> As expected that gets partially autocompleted until "cd AddonsLab_" and stops
> 
> 3) I continue typing until I have "cd AddonsLab_Link" and I hit Tab again
>
> 1) It partially autocompletes to "cd AddonsLab_Linkc" ending with a
> lowercase "c". That makes no sense whatsoever.

That's certainly screwy, but you're not getting basic zsh behaviour here,
and I'm not going to try to speculate what is happening.  If you're
interested enough (sounds like you are) you'll need to backtrack a bit
and find out what configuration you do have.  Probably best to start from
my previous comments (others may have info suggestions).

Probably someone in these parts, or zsh-users, knows more about what's
set up on your distro, with which I'm not familiar.

pws


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [BUG REPORT] Nonsensical behavior in response to Tab key
  2022-11-10 15:21 ` Peter Stephenson
@ 2022-11-10 15:58   ` Bart Schaefer
  0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2022-11-10 15:58 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: php fan, zsh-workers

On Thu, Nov 10, 2022 at 7:21 AM Peter Stephenson
<p.w.stephenson@ntlworld.com> wrote:
>
> > 1) I am inside a directory that contains the following two directories:
> >
> >     AddonsLab_LinkBack
> >     AddonsLab_LinkChecker
> >
> > 1) It partially autocompletes to "cd AddonsLab_Linkc" ending with a
> > lowercase "c". That makes no sense whatsoever.

It's telling you that there is both AddonsLab_LinkBa[c]k and
AddonsLab_LinkChe[c]ker

> That's certainly screwy, but you're not getting basic zsh behaviour here,
> and I'm not going to try to speculate what is happening.

It's got something to do with the matcher-list and ambiguous style
settings, I think, but I can't figure out what from a blackbox.  It
might also have to do with what subdirectories are present inside each
of those.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-10 15:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-10 14:55 [BUG REPORT] Nonsensical behavior in response to Tab key php fan
2022-11-10 15:21 ` Peter Stephenson
2022-11-10 15:58   ` 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).