Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
For user commands, the parsed `arg` was everything in the cmdline after the command name. This meant that for `:DiffviewOpen origin/master --i`, the `arg` was `origin/master --i`. The completions returned by `getcompletion(cmdline, 'cmdline')` returned the completions that are prefixed by the last argument (`--i`, for example `--imply-local`). Then, the filtering code attempted to filter the completions (`["--imply-local"]`) using `origin/master --i`, which did not match. For the `arg`, only the last argument (`--i`) should be used in this case for the filtering to return the correct completions. The consequence was that completions for the 2nd and subsequent were not shown for user commands with `complete` functions in Lua. This commit changes the cmdline parsing logic so that for user commands, only the last argument in the cmdline is parsed as the `arg`. This way the filtering logic correctly matches `--imply-local` as a valid completion for `--i`. The following commands now show completions, whereas they did not show any completions before: * :DiffviewOpen origin/master --i * :Telescope live_grep pre Fixes gelguy#159
- Loading branch information