Re: [PATCH 1/2] git-prompt.sh: strip unnecessary space in prompt string
Junio C Hamano wrote: It is like asking why typeset a space after a sentence a tad wider than a space after each word: Not at all. The prompt has nothing to do with sentences. grouping related things together, and separating groups of different kind apart, to make it more readable. You could argue that the colors are not very well thought-out (branch-name has the same color as +), but I really don't see the problem otherwise. How is this more readable: artagnon|master *=:~/src/git$ than: artagnon|master*=:~/src/git$ (where master is green, * is red, and = is white)? Looking at what we've done so far, I would argue that we're not thinking about the usability of the prompt enough: it currently screams I AM DOING REBASE-i! (and similarly for other operations in progress). I intend to fix these things in future patches. Thanks. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] git-prompt.sh: strip unnecessary space in prompt string
On Mon, May 13, 2013 at 03:43:43PM +0530, Ramkumar Ramachandra wrote: SZEDER Gábor wrote: Don't forget that others might use a different prompt format and using colors in the prompt is optional. With the default prompt format and without colors I find that that space definitely helps readability. I'm finding it hard to believe that anyone would want to use a colorless prompt. Well, back then I was shell-shocked to find that there are people who want colors in their prompt ;) IMHO that's just ugly ;) If we can agree that it's just a matter of taste, we should both be able to have what we want. Any suggestions on how to make this configurable? The same way we make other things configurable in the prompt: specify the GIT_PS1_HIDESTATESEPARATOR or something similar variable to strip that space from the prompt. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] git-prompt.sh: strip unnecessary space in prompt string
On Mon, May 13, 2013 at 01:05:51PM +0200, SZEDER Gábor wrote: On Mon, May 13, 2013 at 03:43:43PM +0530, Ramkumar Ramachandra wrote: If we can agree that it's just a matter of taste, we should both be able to have what we want. Any suggestions on how to make this configurable? The same way we make other things configurable in the prompt: specify the GIT_PS1_HIDESTATESEPARATOR or something similar variable to strip that space from the prompt. Or perhaps better yet: use a variable, e.g. GIT_PS1_STATESEPARATOR or whatever, to specify what should separate the branch name from the repo state, defaulting to a space to keep the current behavior. Gábor -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] git-prompt.sh: strip unnecessary space in prompt string
SZEDER Gábor sze...@ira.uka.de writes: On Mon, May 13, 2013 at 01:05:51PM +0200, SZEDER Gábor wrote: On Mon, May 13, 2013 at 03:43:43PM +0530, Ramkumar Ramachandra wrote: If we can agree that it's just a matter of taste, we should both be able to have what we want. Any suggestions on how to make this configurable? The same way we make other things configurable in the prompt: specify the GIT_PS1_HIDESTATESEPARATOR or something similar variable to strip that space from the prompt. Or perhaps better yet: use a variable, e.g. GIT_PS1_STATESEPARATOR or whatever, to specify what should separate the branch name from the repo state, defaulting to a space to keep the current behavior. Why just a single knob for that SP? If you restructure the code to formulate gitstring to call a shell function to do so, people can override it and come up with whatever format they want to use, no? -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] git-prompt.sh: strip unnecessary space in prompt string
Junio C Hamano wrote: If you restructure the code to formulate gitstring to call a shell function to do so, people can override it and come up with whatever format they want to use, no? The user would essentially have to implement her own __git_ps1_colorize_string; a function that takes a lot of arguments and stitches them together with color. Much too painful for little gain. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] git-prompt.sh: strip unnecessary space in prompt string
Ramkumar Ramachandra artag...@gmail.com writes: Nobody has branch names that end with + or *. Then why put a space after the branch name and before [*|+][=||] in the prompt string? I do not think the space is for disambiguation. It is like asking why typeset a space after a sentence a tad wider than a space after each word: grouping related things together, and separating groups of different kind apart, to make it more readable. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] git-prompt.sh: strip unnecessary space in prompt string
Nobody has branch names that end with + or *. Then why put a space after the branch name and before [*|+][=||] in the prompt string? Before this, your prompt might have looked like: artagnon|master *=:~/src/git$ Now, it will look like: artagnon|master*=:~/src/git$ Signed-off-by: Ramkumar Ramachandra artag...@gmail.com --- contrib/completion/git-prompt.sh | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh index eaf5c36..08c9b22 100644 --- a/contrib/completion/git-prompt.sh +++ b/contrib/completion/git-prompt.sh @@ -383,9 +383,6 @@ __git_ps1 () # is necessary to prevent wrapping issues! gitstring=\[$branch_color\]$branchstring\[$c_clear\] - if [ -n $w$i$s$u$r$p ]; then - gitstring=$gitstring - fi if [ $w = * ]; then gitstring=$gitstring\[$bad_color\]$w fi @@ -400,13 +397,13 @@ __git_ps1 () fi gitstring=$gitstring\[$c_clear\]$r$p else - gitstring=$c${b##refs/heads/}${f:+ $f}$r$p + gitstring=$c${b##refs/heads/}${f:+$f}$r$p fi gitstring=$(printf -- $printf_format $gitstring) PS1=$ps1pc_start$gitstring$ps1pc_end else # NO color option unless in PROMPT_COMMAND mode - printf -- $printf_format $c${b##refs/heads/}${f:+ $f}$r$p + printf -- $printf_format $c${b##refs/heads/}${f:+$f}$r$p fi fi } -- 1.8.3.rc1.52.g4537cf1 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html