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

Fish 3.2.0: __fish_print_pipestatus should unset bold mode where appropriate #7771

Closed
simonwhitaker opened this issue Mar 3, 2021 · 5 comments
Labels
regression Something that used to work, but was broken, especially between releases
Milestone

Comments

@simonwhitaker
Copy link

simonwhitaker commented Mar 3, 2021

Beginning in fish 3.2.0, when run with the default config, __fish_print_pipestatus now prints the pipe and closing brackets in bold. I tested this under sh -c 'env HOME=$(mktemp -d) fish' and can confirm that I get the same behaviour there:

Screenshot 2021-03-03 at 6 06 45 pm

$ __fish_print_pipestatus "[" "]" "|" (set_color red) (set_color --bold red) 9 9 | xxd
00000000: 1b5b 3331 6d5b 1b5b 316d 1b5b 3331 6d39  .[31m[.[1m.[31m9
00000010: 1b5b 3331 6d7c 1b5b 316d 1b5b 3331 6d39  .[31m|.[1m.[31m9
00000020: 1b5b 3331 6d5d 1b28 421b 5b6d            .[31m].(B.[m

My environment:

~ $ fish --version
fish, version 3.2.0
~ $ uname -a
Darwin Simons-MacBook-Pro-2.local 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64
~ $ echo $TERM
xterm-256color
@faho
Copy link
Member

faho commented Mar 3, 2021

Yes, set_color --bold means set_color writes the "enter_bold_mode" string to the terminal.

This is how it has always worked, just like setting the background and other modifiers. set_color normal will reset those.

The difference is that now some of the sample prompts pass a bold color to print_pipestatus. If you don't like it, adjust your prompt to not do that - funced fish_prompt, remove the thing and funcsave fish_prompt.

@faho faho added the question label Mar 3, 2021
@simonwhitaker
Copy link
Author

Yes, set_color --bold means set_color writes the "enter_bold_mode" string to the terminal.

This is how it has always worked, just like setting the background and other modifiers. set_color normal will reset those.

The difference is that now some of the sample prompts pass a bold color to print_pipestatus. If you don't like it, adjust your prompt to not do that - funced fish_prompt, remove the thing and funcsave fish_prompt.

Apologies; I can see now that the issue here isn't with set_color (you're right, my example code of echo (set_color --bold red)red(set_color yellow)yellow works the same way under fish 3.1.2). Strictly speaking it isn't with my prompt either; it's with the implementation of __fish_print_pipestatus. I have indeed run funced __fish_print_pipestatus and saved myself a fixed copy, but fish 3.2.0 running "out the box" exhibits this behaviour that wasn't present in 3.1.2.

I believe this is a regression in 3.2.0. My prompt has used that built-in function (and passed in a bold colour for the $argv[5] (status_color) argument) for a long time, and until upgrading to fish 3.2.0 the prompt rendered as expected.

Thanks for the correction - I'll update the issue name and description accordingly.

@simonwhitaker simonwhitaker changed the title Fish 3.2.0: bold mode is sticky in set_color Fish 3.2.0: __fish_print_pipestatus should unset bold mode where appropriate Mar 3, 2021
@faho
Copy link
Member

faho commented Mar 3, 2021

Okay, so how are you calling __fish_print_pipestatus?

@faho faho added regression Something that used to work, but was broken, especially between releases and removed question labels Mar 3, 2021
@faho faho added this to the fish 3.2.1 milestone Mar 3, 2021
@faho
Copy link
Member

faho commented Mar 3, 2021

Ah, okay, I managed to reproduce, fix incoming.

@faho faho closed this as completed in 0a3fec5 Mar 3, 2021
@simonwhitaker
Copy link
Author

Great stuff, thanks!

faho added a commit to faho/fish-shell that referenced this issue Mar 3, 2021
Called as

__fish_print_pipestatus "[foo" "oof]" "|" (set_color green) (set_color --bold blue) 0 1 2

it would make the closing `oof]` bold green.

Fixes fish-shell#7771.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
regression Something that used to work, but was broken, especially between releases
Projects
None yet
Development

No branches or pull requests

2 participants