https://bz.mercurial-scm.org/show_bug.cgi?id=5515

            Bug ID: 5515
           Summary: zsh completion: after abbreviation 'bo' for
                    'bookmarks' the wrong set of completions is offered.
           Product: Mercurial
           Version: 4.1.1
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: bug
          Priority: wish
         Component: third-party
          Assignee: bugzi...@mercurial-scm.org
          Reporter: mtie...@gmx.com
                CC: mercurial-devel@mercurial-scm.org

Hi, 

Summary:
I use zsh completion provided in contrib/.
A minor issue I found is when using the abbreviation 'bo' for 'bookmarks'
the set of completions offered are the 'global' ones instead of the 
'bookmarks'-specific ones.

Example:
when typing
$ hg bo --re<TAB>
it completes to
$ hg bo --repository=

Instead it should offer the same completions as when using 'bookmark'
$ hg bookmark --re<TAB>
 -- option --
--rename      -- rename a given bookmark
--repository  -- repository root directory
--rev         -- revision

Analysis:
In
https://www.mercurial-scm.org/repo/hg-stable/file/ed5b25874d99/contrib/zsh_completion
it goes wrong in lines 96/97:
In l.96 it searches for 'bo*' from the front of the list of all command
finding 'bookmarks'.
In the condition in l.97 it compares the previously found match with the first
match starting from the back of the list of all commands ('bookmark'). The 
condition is therefore not fulfilled and the original command ('bo') is not
replaced with 'bookmarks'. This leads to the completion offering the 'normal'
completions in l.122/123. 

To me it is not obvious why the implementation uses once the first match from 
the start the list of all commands and once from the end. Using the always
the first one works for me in my daily work but I do not know enough about
Mercurial to be sure that this is the way to go.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to