mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-25 08:56:43 +08:00
Do not add spaces after completions ending in "-"
Some programs use this to separate things in a word, see https://github.com/spf13/cobra/pull/1249#discussion_r563605048 Require the token to be at least length 2 for the no-space behavior, for completions of "-" like for python.
This commit is contained in:
parent
b5df9a7137
commit
e27d97b02e
|
@ -194,8 +194,7 @@ Interactive improvements
|
|||
- The interactive reader now allows ending a line in a logical operators (``&&`` and ``||``) instead of complaining about a missing command
|
||||
(This was already syntactically valid, but interactive sessions didn't know about it yet).
|
||||
- The prompt is reprinted after a background job exits (:issue:`1018`).
|
||||
- fish no longer inserts a space after a completion ending in ``.`` or
|
||||
``,`` is accepted (:issue:`6928`).
|
||||
- fish no longer inserts a space after a completion ending in ``.``, ``,`` or ``-`` is accepted (:issue:`6928`).
|
||||
- If a filename is invalid when first pressing Tab, but becomes valid, it will be completed properly on the next attempt (:issue:`6863`).
|
||||
- ``help string match/replace/<subcommand>`` will show the help for string subcommands (:issue:`6786`).
|
||||
- ``fish_key_reader`` sets the exit status to 0 when used with ``--help`` or ``--version`` (:issue:`6964`).
|
||||
|
|
|
@ -196,7 +196,7 @@ static complete_flags_t resolve_auto_space(const wcstring &comp, complete_flags_
|
|||
if (flags & COMPLETE_AUTO_SPACE) {
|
||||
new_flags &= ~COMPLETE_AUTO_SPACE;
|
||||
size_t len = comp.size();
|
||||
if (len > 0 && (std::wcschr(L"/=@:.,", comp.at(len - 1)) != nullptr))
|
||||
if (len > 1 && (std::wcschr(L"/=@:.,-", comp.at(len - 1)) != nullptr))
|
||||
new_flags |= COMPLETE_NO_SPACE;
|
||||
}
|
||||
return new_flags;
|
||||
|
|
|
@ -1868,7 +1868,7 @@ static uint32_t get_best_rank(const completion_list_t &comp) {
|
|||
///
|
||||
/// - If the list is empty, flash the terminal.
|
||||
/// - If the list contains one element, write the whole element, and if the element does not end on
|
||||
/// a '/', '@', ':', '.', ',' or a '=', also write a trailing space.
|
||||
/// a '/', '@', ':', '.', ',', '-' or a '=', also write a trailing space.
|
||||
/// - If the list contains multiple elements, insert their common prefix, if any and display
|
||||
/// the list in the pager. Depending on terminal size and the length of the list, the pager
|
||||
/// may either show less than a screenfull and exit or use an interactive pager to allow the
|
||||
|
|
Loading…
Reference in New Issue
Block a user