Skip to content

fish_prompt_pwd_full_dirs variable gets reset to 1 every time a prompt appears #9123

@jakubdabek

Description

@jakubdabek

The behavior is as follows (at current master):

<host> ~/l/k/f/build (master)> set -e fish_prompt_pwd_full_dirs
<host> ~/l/k/f/build (master)> set -S fish_prompt_pwd_full_dirs
<host> ~/l/k/f/build (master)> set -U fish_prompt_pwd_full_dirs 2
<host> ~/l/k/fish-shell/build (master)> set -S fish_prompt_pwd_full_dirs
$fish_prompt_pwd_full_dirs: set in universal scope, unexported, with 1 elements
$fish_prompt_pwd_full_dirs[1]: |1|
<host> ~/l/k/f/build (master)> set -U fish_prompt_pwd_full_dirs 2; set -S fish_prompt_pwd_full_dirs
$fish_prompt_pwd_full_dirs: set in universal scope, unexported, with 1 elements
$fish_prompt_pwd_full_dirs[1]: |2|
<host> ~/l/k/fish-shell/build (master)>
<host> ~/l/k/f/build (master)>

What's going on is that prompt_pwd incorrectly sets the global variable instead of the local one when using flags:

set -ql _flag_d
and set -l fish_prompt_pwd_dir_length $_flag_d
set -q fish_prompt_pwd_dir_length
or set -l fish_prompt_pwd_dir_length 1
set -l fulldirs 0
set -ql _flag_D
and set fish_prompt_pwd_full_dirs $_flag_D
set -q fish_prompt_pwd_full_dirs
or set -l fish_prompt_pwd_full_dirs 1

See lines 15 and 22. The fix would be to set the local instead:

- and set fish_prompt_pwd_full_dirs $_flag_D
+ and set -l fish_prompt_pwd_full_dirs $_flag_D

Sidenote - the variable is changed every time a prompt appears, because prompt_pwd is called in fish_title:

echo -- $ssh (string sub -l 20 -- $argv[1]) (prompt_pwd -d 1 -D 1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that's not working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions