fish_greeting: show private mode message if $fish_greeting is empty list

This was droped because of Cartesian product expansion.
Also fix the spurious dot in case the greeting is "".

Fixes #7974
This commit is contained in:
Johannes Altmanninger 2021-05-05 18:40:59 +02:00
parent 889ff25c75
commit fa74dc977b
2 changed files with 6 additions and 1 deletions

View File

@ -41,6 +41,7 @@ Interactive improvements
- ``funced`` won't include an entry on where a function is defined, thanks to the new ``functions --no-details`` option (:issue:`7879`). - ``funced`` won't include an entry on where a function is defined, thanks to the new ``functions --no-details`` option (:issue:`7879`).
- The git prompt now has the same symbol order in normal and "informative" mode, and it's customizable via ``$__fish_git_prompt_status_order`` (:issue:`7926`). - The git prompt now has the same symbol order in normal and "informative" mode, and it's customizable via ``$__fish_git_prompt_status_order`` (:issue:`7926`).
- Variable ``fish_killring`` containing entries from killring is now available (:issue:`7445`). - Variable ``fish_killring`` containing entries from killring is now available (:issue:`7445`).
- ``fish --private`` prints a note on private mode on startup even if ``$fish_greeting`` is an empty list (:issue:`7974`).
New or improved bindings New or improved bindings
^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -7,7 +7,11 @@ function fish_greeting
if set -q fish_private_mode if set -q fish_private_mode
set -l line (_ "fish is running in private mode, history will not be persisted.") set -l line (_ "fish is running in private mode, history will not be persisted.")
set -g fish_greeting $fish_greeting.\n$line if set -q fish_greeting[1]
set -g fish_greeting $fish_greeting\n$line
else
set -g fish_greeting $line
end
end end
# The greeting used to be skipped when fish_greeting was empty (not just undefined) # The greeting used to be skipped when fish_greeting was empty (not just undefined)