Don't assume $__fish_git_prompt_char_cleanstate is non-empty#7471
Merged
faho merged 1 commit intofish-shell:masterfrom Nov 10, 2020
Merged
Don't assume $__fish_git_prompt_char_cleanstate is non-empty#7471faho merged 1 commit intofish-shell:masterfrom
faho merged 1 commit intofish-shell:masterfrom
Conversation
This fixes the case where an empty "clean state" character can cause a spurious space character at the end of the git prompt.
Contributor
Author
|
I looked at the test failure but it doesn't appear to be related to my change. Let me know if I'm wrong about that. |
Member
|
It's not, Github's macos test machines are just awful, and we need to work out some of the kinks. (necessary because Travis made their Open-source plan unusable) |
Member
|
Merged, thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes the case where an empty "clean state" character
can cause a spurious space character at the end of the git prompt.
Description
I've been trying to integrate fish_git_prompt into a custom prompt and running into minor issues. The first was fixed by discovering the undocumented argument where you can pass in a format string. The second is fixed by this commit. When running the prompt in informative mode with
$__fish_git_prompt_char_cleanstateset to an empty string while inside a clean repository, the prompt looks like this:(master )Note the spurious space after
master. Minor but a bit ugly/annoying. Even when passing in "%s" as the argument to fish_git_prompt and running the result throughstring trim, the output will still bemasterwith a trailing space, presumably because some color codes are getting in the way of the trim operation. So this commit adds a couple simple checks in and around the informative status function to make sure we aren't echoing spurious output.Thanks!
TODOs: