Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird behavior at startup #240

Closed
smorimoto opened this issue Dec 3, 2020 · 17 comments · Fixed by #244
Closed

Weird behavior at startup #240

smorimoto opened this issue Dec 3, 2020 · 17 comments · Fixed by #244

Comments

@smorimoto
Copy link
Contributor

gif

Env

Pure:

echo $pure_version
3.1.0

Fish:

fish --version
fish, version 3.1.2

OS/distribution:

lsb_release -a
LSB Version:    1.0
Distributor ID: VoidLinux
Description:    Void Linux
Release:        rolling
Codename:       void
@edouard-lopez
Copy link
Member

That doesn't look like pure :/

  1. How did you install?

  2. Does your config file import pure correctly?

    $EDITOR $__fish_config_dir/config.fish
    
  3. What the output of:

    type fish_prompt
    

@smorimoto
Copy link
Contributor Author

Hmm... This doesn't happen with the default fish themes. So I thought pure is the cause.

  1. I installed it with the latest fisher.

  2. https://github.com/smorimoto/dotfiles/blob/master/config/fish/config.fish

~
λ type fish_prompt
fish_prompt is a function with definition
# Defined in /home/sora/.config/fish/functions/fish_prompt.fish @ line 1
function fish_prompt
    set --local exit_code $status  # save previous exit code

    echo -e -n (_pure_prompt_beginning)  # init prompt context (clear current line, etc.)
    echo -e (_pure_prompt_first_line)  # print current path, git branch/status, command duration
    _pure_place_iterm2_prompt_mark # place iTerm shell integration mark
    echo -e -n (_pure_prompt $exit_code)  # print prompt
    echo -e (_pure_prompt_ending)  # reset colors and end prompt

    set _pure_fresh_session false
end

@edouard-lopez
Copy link
Member

As it seems you use lambda symbol instead of default arrow, could you describe what you expected vs what you got?

What do you get when

source /home/sora/.config/fish/functions/fish_prompt.fish 
fish_prompt

@smorimoto
Copy link
Contributor Author

I get nothing. By the way, what I wanted to say with the GIF is that the word "fish" appears at startup.

~/src/github.com/smorimoto/dotfiles
λ source /home/sora/.config/fish/functions/fish_prompt.fish

~/src/github.com/smorimoto/dotfiles
λ fish_prompt
~/src/github.com/smorimoto/dotfiles
λ

@edouard-lopez
Copy link
Member

Can you try to see where it comes from:

fish_trace=1 fish >/tmp/fish-debug.txt 2>&1

Then explore the content of /tmp/fish-debug.txt to find occurence of fish⏎ or whatever is print at the top.

@smorimoto
Copy link
Contributor Author

Here is the diff for tracing with and without pure.

diff
125c125,136
< +++ for /home/sora/.config/fish/conf.d/abbreviations.fish /home/sora/.config/fish/conf.d/aliases.fish /home/sora/.config/fish/conf.d/editor.fish /home/sora/.config/fish/conf.d/ghq.fish /home/sora/.config/fish/conf.d/ghq_key_bindings.fish /home/sora/.config/fish/conf.d/greeting.fish /home/sora/.config/fish/conf.d/peco.fish /home/sora/.config/fish/conf.d/prompt.fish
---
> +++ for /home/sora/.config/fish/conf.d/_pure_init.fish /home/sora/.config/fish/conf.d/abbreviations.fish /home/sora/.config/fish/conf.d/aliases.fish /home/sora/.config/fish/conf.d/editor.fish /home/sora/.config/fish/conf.d/ghq.fish /home/sora/.config/fish/conf.d/ghq_key_bindings.fish /home/sora/.config/fish/conf.d/greeting.fish /home/sora/.config/fish/conf.d/peco.fish /home/sora/.config/fish/conf.d/prompt.fish /home/sora/.config/fish/conf.d/pure.fish
> +++++ string replace -r '^.*/' '' -- /home/sora/.config/fish/conf.d/_pure_init.fish
> ++++ set -l basename _pure_init.fish
> ++++ contains -- _pure_init.fish
> ++++ set sourcelist _pure_init.fish
> ++++ '[' -f /home/sora/.config/fish/conf.d/_pure_init.fish -a -r /home/sora/.config/fish/conf.d/_pure_init.fish ']'
> ++++ source /home/sora/.config/fish/conf.d/_pure_init.fish
> ++++++ set --global --export VIRTUAL_ENV_DISABLE_PROMPT 1
> ++++++ set --global _pure_fresh_session true
> ++++++ functions -q _pure_prompt_new_line
> +++++++ source /home/sora/.config/fish/functions/_pure_prompt_new_line.fish
> +++++++++ function _pure_prompt_new_line --description 'Do not add a line break to a brand new session' --on-event fish_prompt
128,129c139,140
< ++++ contains -- abbreviations.fish
< ++++ set sourcelist abbreviations.fish
---
> ++++ contains -- abbreviations.fish _pure_init.fish
> ++++ set sourcelist _pure_init.fish abbreviations.fish
744,745c755,756
< ++++ contains -- aliases.fish abbreviations.fish
< ++++ set sourcelist abbreviations.fish aliases.fish
---
> ++++ contains -- aliases.fish _pure_init.fish abbreviations.fish
> ++++ set sourcelist _pure_init.fish abbreviations.fish aliases.fish
1192,1193c1203,1204
< ++++ contains -- editor.fish abbreviations.fish aliases.fish
< ++++ set sourcelist abbreviations.fish aliases.fish editor.fish
---
> ++++ contains -- editor.fish _pure_init.fish abbreviations.fish aliases.fish
> ++++ set sourcelist _pure_init.fish abbreviations.fish aliases.fish editor.fish
1199,1200c1210,1211
< ++++ contains -- ghq.fish abbreviations.fish aliases.fish editor.fish
< ++++ set sourcelist abbreviations.fish aliases.fish editor.fish ghq.fish
---
> ++++ contains -- ghq.fish _pure_init.fish abbreviations.fish aliases.fish editor.fish
> ++++ set sourcelist _pure_init.fish abbreviations.fish aliases.fish editor.fish ghq.fish
1206,1207c1217,1218
< ++++ contains -- ghq_key_bindings.fish abbreviations.fish aliases.fish editor.fish ghq.fish
< ++++ set sourcelist abbreviations.fish aliases.fish editor.fish ghq.fish ghq_key_bindings.fish
---
> ++++ contains -- ghq_key_bindings.fish _pure_init.fish abbreviations.fish aliases.fish editor.fish ghq.fish
> ++++ set sourcelist _pure_init.fish abbreviations.fish aliases.fish editor.fish ghq.fish ghq_key_bindings.fish
1217,1218c1228,1229
< ++++ contains -- greeting.fish abbreviations.fish aliases.fish editor.fish ghq.fish ghq_key_bindings.fish
< ++++ set sourcelist abbreviations.fish aliases.fish editor.fish ghq.fish ghq_key_bindings.fish greeting.fish
---
> ++++ contains -- greeting.fish _pure_init.fish abbreviations.fish aliases.fish editor.fish ghq.fish ghq_key_bindings.fish
> ++++ set sourcelist _pure_init.fish abbreviations.fish aliases.fish editor.fish ghq.fish ghq_key_bindings.fish greeting.fish
1224,1225c1235,1236
< ++++ contains -- peco.fish abbreviations.fish aliases.fish editor.fish ghq.fish ghq_key_bindings.fish greeting.fish
< ++++ set sourcelist abbreviations.fish aliases.fish editor.fish ghq.fish ghq_key_bindings.fish greeting.fish peco.fish
---
> ++++ contains -- peco.fish _pure_init.fish abbreviations.fish aliases.fish editor.fish ghq.fish ghq_key_bindings.fish greeting.fish
> ++++ set sourcelist _pure_init.fish abbreviations.fish aliases.fish editor.fish ghq.fish ghq_key_bindings.fish greeting.fish peco.fish
1231,1232c1242,1243
< ++++ contains -- prompt.fish abbreviations.fish aliases.fish editor.fish ghq.fish ghq_key_bindings.fish greeting.fish peco.fish
< ++++ set sourcelist abbreviations.fish aliases.fish editor.fish ghq.fish ghq_key_bindings.fish greeting.fish peco.fish prompt.fish
---
> ++++ contains -- prompt.fish _pure_init.fish abbreviations.fish aliases.fish editor.fish ghq.fish ghq_key_bindings.fish greeting.fish peco.fish
> ++++ set sourcelist _pure_init.fish abbreviations.fish aliases.fish editor.fish ghq.fish ghq_key_bindings.fish greeting.fish peco.fish prompt.fish
1236a1248,1451
> +++++ string replace -r '^.*/' '' -- /home/sora/.config/fish/conf.d/pure.fish
> ++++ set -l basename pure.fish
> ++++ contains -- pure.fish _pure_init.fish abbreviations.fish aliases.fish editor.fish ghq.fish ghq_key_bindings.fish greeting.fish peco.fish prompt.fish
> ++++ set sourcelist _pure_init.fish abbreviations.fish aliases.fish editor.fish ghq.fish ghq_key_bindings.fish greeting.fish peco.fish prompt.fish pure.fish
> ++++ '[' -f /home/sora/.config/fish/conf.d/pure.fish -a -r /home/sora/.config/fish/conf.d/pure.fish ']'
> ++++ source /home/sora/.config/fish/conf.d/pure.fish
> ++++++ set --global pure_version 3.2.0
> +++++++ source /home/sora/.config/fish/functions/_pure_set_default.fish
> +++++++++ function _pure_set_default --description 'Set default value for configuration variable' --argument-names var default
> ++++++ _pure_set_default pure_color_primary blue
> ++++++++ if
> ++++++++ set --query --universal pure_color_primary
> ++++++++ test -z blue
> ++++++++ end if
> ++++++ _pure_set_default pure_color_info cyan
> ++++++++ if
> ++++++++ set --query --universal pure_color_info
> ++++++++ test -z cyan
> ++++++++ end if
> ++++++ _pure_set_default pure_color_mute brblack
> ++++++++ if
> ++++++++ set --query --universal pure_color_mute
> ++++++++ test -z brblack
> ++++++++ end if
> ++++++ _pure_set_default pure_color_success magenta
> ++++++++ if
> ++++++++ set --query --universal pure_color_success
> ++++++++ test -z magenta
> ++++++++ end if
> ++++++ _pure_set_default pure_color_normal normal
> ++++++++ if
> ++++++++ set --query --universal pure_color_normal
> ++++++++ test -z normal
> ++++++++ end if
> ++++++ _pure_set_default pure_color_danger red
> ++++++++ if
> ++++++++ set --query --universal pure_color_danger
> ++++++++ test -z red
> ++++++++ end if
> ++++++ _pure_set_default pure_color_light white
> ++++++++ if
> ++++++++ set --query --universal pure_color_light
> ++++++++ test -z white
> ++++++++ end if
> ++++++ _pure_set_default pure_color_warning yellow
> ++++++++ if
> ++++++++ set --query --universal pure_color_warning
> ++++++++ test -z yellow
> ++++++++ end if
> ++++++ _pure_set_default pure_color_dark black
> ++++++++ if
> ++++++++ set --query --universal pure_color_dark
> ++++++++ test -z black
> ++++++++ end if
> ++++++ _pure_set_default pure_symbol_prompt ❯
> ++++++++ if
> ++++++++ set --query --universal pure_symbol_prompt
> ++++++++ test -z λ
> ++++++++ end if
> ++++++ _pure_set_default pure_symbol_reverse_prompt ❮
> ++++++++ if
> ++++++++ set --query --universal pure_symbol_reverse_prompt
> ++++++++ test -z â
> ++++++++ end if
> ++++++ _pure_set_default pure_color_prompt_on_error pure_color_danger
> ++++++++ if
> ++++++++ set --query --universal pure_color_prompt_on_error
> ++++++++ test -z pure_color_danger
> ++++++++ end if
> ++++++ _pure_set_default pure_color_prompt_on_success pure_color_success
> ++++++++ if
> ++++++++ set --query --universal pure_color_prompt_on_success
> ++++++++ test -z pure_color_success
> ++++++++ end if
> ++++++ _pure_set_default pure_color_current_directory pure_color_primary
> ++++++++ if
> ++++++++ set --query --universal pure_color_current_directory
> ++++++++ test -z pure_color_primary
> ++++++++ end if
> ++++++ _pure_set_default pure_enable_git true
> ++++++++ if
> ++++++++ set --query --universal pure_enable_git
> ++++++++ test -z false
> ++++++++ end if
> ++++++ _pure_set_default pure_symbol_git_unpulled_commits ⇣
> ++++++++ if
> ++++++++ set --query --universal pure_symbol_git_unpulled_commits
> ++++++++ test -z â£
> ++++++++ end if
> ++++++ _pure_set_default pure_symbol_git_unpushed_commits ⇡
> ++++++++ if
> ++++++++ set --query --universal pure_symbol_git_unpushed_commits
> ++++++++ test -z â¡
> ++++++++ end if
> ++++++ _pure_set_default pure_symbol_git_dirty '*'
> ++++++++ if
> ++++++++ set --query --universal pure_symbol_git_dirty
> ++++++++ test -z '*'
> ++++++++ end if
> ++++++ _pure_set_default pure_symbol_git_stash ≡
> ++++++++ if
> ++++++++ set --query --universal pure_symbol_git_stash
> ++++++++ test -z ≡
> ++++++++ end if
> ++++++ _pure_set_default pure_color_git_unpulled_commits pure_color_info
> ++++++++ if
> ++++++++ set --query --universal pure_color_git_unpulled_commits
> ++++++++ test -z pure_color_info
> ++++++++ end if
> ++++++ _pure_set_default pure_color_git_unpushed_commits pure_color_info
> ++++++++ if
> ++++++++ set --query --universal pure_color_git_unpushed_commits
> ++++++++ test -z pure_color_info
> ++++++++ end if
> ++++++ _pure_set_default pure_color_git_branch pure_color_mute
> ++++++++ if
> ++++++++ set --query --universal pure_color_git_branch
> ++++++++ test -z pure_color_mute
> ++++++++ end if
> ++++++ _pure_set_default pure_color_git_dirty pure_color_mute
> ++++++++ if
> ++++++++ set --query --universal pure_color_git_dirty
> ++++++++ test -z pure_color_mute
> ++++++++ end if
> ++++++ _pure_set_default pure_color_ssh_hostname pure_color_mute
> ++++++++ if
> ++++++++ set --query --universal pure_color_ssh_hostname
> ++++++++ test -z pure_color_mute
> ++++++++ end if
> ++++++ _pure_set_default pure_color_ssh_separator pure_color_mute
> ++++++++ if
> ++++++++ set --query --universal pure_color_ssh_separator
> ++++++++ test -z pure_color_mute
> ++++++++ end if
> ++++++ _pure_set_default pure_color_ssh_user_normal pure_color_mute
> ++++++++ if
> ++++++++ set --query --universal pure_color_ssh_user_normal
> ++++++++ test -z pure_color_mute
> ++++++++ end if
> ++++++ _pure_set_default pure_color_ssh_user_root pure_color_light
> ++++++++ if
> ++++++++ set --query --universal pure_color_ssh_user_root
> ++++++++ test -z pure_color_light
> ++++++++ end if
> ++++++ _pure_set_default pure_show_jobs false
> ++++++++ if
> ++++++++ set --query --universal pure_show_jobs
> ++++++++ test -z false
> ++++++++ end if
> ++++++ _pure_set_default pure_color_jobs pure_color_normal
> ++++++++ if
> ++++++++ set --query --universal pure_color_jobs
> ++++++++ test -z pure_color_normal
> ++++++++ end if
> ++++++ _pure_set_default pure_show_system_time false
> ++++++++ if
> ++++++++ set --query --universal pure_show_system_time
> ++++++++ test -z false
> ++++++++ end if
> ++++++ _pure_set_default pure_color_system_time pure_color_mute
> ++++++++ if
> ++++++++ set --query --universal pure_color_system_time
> ++++++++ test -z pure_color_mute
> ++++++++ end if
> ++++++ _pure_set_default pure_color_virtualenv pure_color_mute
> ++++++++ if
> ++++++++ set --query --universal pure_color_virtualenv
> ++++++++ test -z pure_color_mute
> ++++++++ end if
> ++++++ _pure_set_default pure_begin_prompt_with_current_directory true
> ++++++++ if
> ++++++++ set --query --universal pure_begin_prompt_with_current_directory
> ++++++++ test -z true
> ++++++++ end if
> ++++++ _pure_set_default pure_separate_prompt_on_error false
> ++++++++ if
> ++++++++ set --query --universal pure_separate_prompt_on_error
> ++++++++ test -z false
> ++++++++ end if
> ++++++ _pure_set_default pure_threshold_command_duration 5
> ++++++++ if
> ++++++++ set --query --universal pure_threshold_command_duration
> ++++++++ test -z 5
> ++++++++ end if
> ++++++ _pure_set_default pure_color_command_duration pure_color_warning
> ++++++++ if
> ++++++++ set --query --universal pure_color_command_duration
> ++++++++ test -z pure_color_warning
> ++++++++ end if
> ++++++ _pure_set_default pure_reverse_prompt_symbol_in_vimode true
> ++++++++ if
> ++++++++ set --query --universal pure_reverse_prompt_symbol_in_vimode
> ++++++++ test -z true
> ++++++++ end if
> ++++++ _pure_set_default pure_symbol_title_bar_separator —
> ++++++++ if
> ++++++++ set --query --universal pure_symbol_title_bar_separator
> ++++++++ test -z â
> ++++++++ end if
> ++++++ _pure_set_default pure_check_for_new_release false
> ++++++++ if
> ++++++++ set --query --universal pure_check_for_new_release
> ++++++++ test -z false
> ++++++++ end if
1391,1393c1606,1609
< + source /usr/share/fish/functions/fish_prompt.fish
< +++ function fish_prompt --description 'Write out the prompt'
sora@sora ~>
---
> + source /home/sora/.config/fish/functions/fish_prompt.fish
> +++ function fish_prompt
~
> λ

@edouard-lopez
Copy link
Member

I don't see anything related to the pre-prompt text, maybe @faho would know what's up with this text appearing on new shell

fish⏎

@faho
Copy link
Contributor

faho commented Dec 11, 2020

This looks like fish printing the terminal title. It seems your OS/terminal combo can't deal with it. Try removing your fish_title function.

Note that the "⏎" isn't part of the output, fish adds it later to get the prompt onto a new line. If there is no newline, it'll show up, if there is it'll be overwritten.

Also:

OS/distribution:

Distributor ID: VoidLinux

Going by the gif, this actually looks like WSL - which is an... idiosyncratic system that requires some workarounds. Mentioning it helps! (as does mentioning the terminal you use)

@smorimoto
Copy link
Contributor Author

Oh, I removed fish_title and then it now works as expected.

@edouard-lopez
Copy link
Member

Thanks @faho, I'm closing then

@smorimoto
Copy link
Contributor Author

By removing $pure_symbol_title_bar_separator, fish_title works as expected, but I still don't understand the cause of this.

@smorimoto
Copy link
Contributor Author

@faho I'm using WSL2, Windows Terminal and Void Linux. But, WSL2 is a complete Linux kernel (like Docker for Mac/Win), so everything should just works. (Well, there are some incompatibilities on WSL1, but they're strictly in Microsoft's court. They steadily fix some of these things.)

@faho
Copy link
Contributor

faho commented Dec 11, 2020

I'm using WSL2, Windows Terminal and Void Linux. But, WSL2 is a complete Linux kernel (like Docker for Mac/Win), so everything should just works.

Well, it doesn't. In particular the terminal is still a windows thing, and it's still kinda weird and e.g. doesn't support bracketed paste.

In this case, it seems to confuse the title-bar-separator with the end of the terminal title sequence - what did you set it to?

@smorimoto
Copy link
Contributor Author

I have not set anything for $pure_symbol_title_bar_separator. That is, the default - should be used.

@smorimoto
Copy link
Contributor Author

It's a little weird but adding this to the configuration solves the problem.

set -gx pure_symbol_title_bar_separator "-"

@edouard-lopez
Copy link
Member

So maybe we should change the default title bar separator as it will prevent issue for other people quite easily.

@smorimoto Do you want to submit a PR?

@smorimoto
Copy link
Contributor Author

@edouard-lopez I opened it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants