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

Not upstream indicator taking up too much space #109

Open
valorin opened this issue Feb 27, 2017 · 12 comments
Open

Not upstream indicator taking up too much space #109

valorin opened this issue Feb 27, 2017 · 12 comments

Comments

@valorin
Copy link

valorin commented Feb 27, 2017

I have a strange issue with the not upstream indicator. For some reason it's taking up more space than it should and is shifting the rest of the characters in the line across.

image

It doesn't look that bad in the screenshot, but it actually causes issues occasionally where the cursor will be offset with the character it's modifying, which is confusing and annoying. If I manage to trigger it again, I'll update this issue with a screenshot...

I'm running git-radar master branch (2ac25e3) in bash on Ubuntu 16.06 with export PS1="$PS1\$(git-radar --bash --fetch)". (Need any other info?)

@hallzy
Copy link
Contributor

hallzy commented Feb 28, 2017

The image you provided doesn't seem to be working for me so I can't really see your issue.

Apart from that I would say that if you have a .gitradarrc file, show the contents of that, and if you have anything else in your prompt (PS1 variable) elsewhere in your bashrc, that would be useful probably too (or any other custom settings for git-radar)

Also, has this worked in the past, or is this the first time you have started using gitradar? And any steps to reproduce would be good too (unless it seems to happen no matter what, or seemingly random times)

@valorin
Copy link
Author

valorin commented Feb 28, 2017

No .gitradarrc, the only other line in .bashrrc is:

    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

I've been using gitradar for months/years (and loving it), but it's only recently started doing this. I'm pretty sure it started doing it randomly one day - so then I updated to latest, with no change in the behaviour.

This shows the problem, note the lack of space after >> on the first line:

valorin@aragorn:/tmp/r1⟫ (upstream ⚡ master) >>git status
valorin@aragorn:/tmp/r2⟫ (master) >> git status

I was doing more debugging and it appears to only be occurring when I use gitradar within http://byobu.co/, which is basically a fancy UI on top of tmux. After jumping out of that, it works fine. But it used to work fine in byobu...

@hallzy
Copy link
Contributor

hallzy commented Feb 28, 2017

Interesting... I cloned byobu and I don't see the same thing as you... it is the same for me regardless of what repo I am in, or if it is untracked or tracked, both with my prompt and the one you provided... that is, there is no space at all after the branch name (though that can be fixed by adding a space at the end of the git-radar call in the PS1)

btw, are the >> characters part of your prompt as well, or is that a place holder to just emphasize the missing space? I just ask, because the PS1 variable given above doesn't seem to have that when I tried using your prompt.

This is exactly what I get (note that I believe I have a separate setting that formats the cwd in this way):

steven@vaio-mate:~/.../git-repos/remote-github/byobu$  git:(upstream ⚡ new)git status
steven@vaio-mate:~/.../git-repos/remote-github/byobu$  git:(master)git status

If I change the prompt a little I get this:

steven@vaio-mate:~/.../git-repos/remote-github/byobu git:(master) $ git status
steven@vaio-mate:~/.../git-repos/remote-github/byobu git:(upstream ⚡ new) $ git status
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]'
export PS1="$PS1\$(git-radar --bash --fetch) $ "

But I sense that this isn't your issue

@hallzy
Copy link
Contributor

hallzy commented Feb 28, 2017

I just realized that you meant actually using byobu, not working within its code, so the above message really is of no use. I will see if I can try byobu

@valorin
Copy link
Author

valorin commented Feb 28, 2017

Oooh, good point about >>, you've just reminded me that I did customise it ages ago... I just did some digging and found I'd modified the radar-base.sh file to add in the >>, etc. Reverting it back to the original version doesn't actually help though...

The cursor is still in the wrong spot, and now it's overwriting the ( character...

valorin@aragorn:/tmp/r1⟫  git:(upstream ⚡ mastergit status
valorin@aragorn:/tmp/r2⟫  git:(master)git status

Also the stash character appears to be extra-wide so it's going into half of the next character... and github file uploads are broken...

@hallzy
Copy link
Contributor

hallzy commented Feb 28, 2017

changing your PS1 as below:

export PS1="$PS1\$(git-radar --bash --fetch) >> "

I would think that that would accomplish what you had done to get the >> into your prompt, but without modifying the git-radar code. Again, this is unlikely to solve your problem though.

To get into byobu do you just run the command byobu? When I do that I still don't see the same issue as you. Spacing still seems fine to me.

@valorin
Copy link
Author

valorin commented Feb 28, 2017

Yep, you just run byobu to launch it. I do have the Ubuntu PPA version, not latest from code.. I might try downloading that, in case it's an issue they've fixed.

I modified radar-base.sh because adding >> into the PS1 line would've appended it onto every console prompt, but I only want it as a spacer when the git-radar output is displayed.

@hallzy
Copy link
Contributor

hallzy commented Feb 28, 2017

Ah, that makes sense. That could be a configuration feature to add to git-radar actually... just to make it easier.

I installed it with the Ubuntu PPA as well:

$ byobu -v
byobu version 5.106
tmux 2.1

@valorin
Copy link
Author

valorin commented Feb 28, 2017

Yeah, that'd be a cool config option - I'd definitely use it. :-)

> byobu -v
byobu version 5.115
tmux 2.2

Well scrap that theory then... If you can't replicate it, then I'm not sure what's left to do apart from wait for someone else to experience it, or stumble upon the cause.

@hallzy
Copy link
Contributor

hallzy commented Feb 28, 2017

ya I don't know. I tried upgrading to tmux 2.2 as well, but still couldn't replicate. I will have a look at the code and see if anything stands out, and I'll continue to use byobu for a bit and see if I come across anything.

Unless you made another change to git-radar that you forgot about, or there is some other configuration that was forgotten. Either way, I will keep an eye out for anything.

Maybe I will push a pull request for that configuration as well. Seems like a good idea.

The owner of this repo seems to have been inactive for a bit though, so I am not sure when such a change would even make it into the repo.

@hallzy
Copy link
Contributor

hallzy commented Feb 28, 2017

@valorin just wanted to let you know that I pushed a pr #110 that adds a two variables to allow both a prefix, and a suffix to git-radar. Again, I don't know when, or even if it will get accepted, so if you want to use it I guess just copy the changes over somehow if you want to use it. I specified the .gitradarrc file, but I believe all those variables also work defined inside of the bashrc as well.

@valorin
Copy link
Author

valorin commented Mar 1, 2017

Thanks @hallzy! :-)

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

No branches or pull requests

2 participants