Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

Way to align right hand segments with edge of terminal #110

Closed
keirlawson opened this issue Oct 7, 2015 · 10 comments
Closed

Way to align right hand segments with edge of terminal #110

keirlawson opened this issue Oct 7, 2015 · 10 comments

Comments

@keirlawson
Copy link

Using this theme with gnome terminal I am finding there is a one character gap between the right hand segment and the edge of the terminal. Is there any way to get rid of this?

zshissue

@dritter
Copy link
Member

dritter commented Oct 7, 2015

@keirlawson the right hand indent is controlled by the variable ZLE_RPROMPT_INDENT in ZSH. I tried once to get rid of the gap by setting it to 0, but it messed up the cursor position. I haven't had time to fix this yet.

From the manpage:

ZLE_RPROMPT_INDENT
If set, used to give the indentation between the right hand side of the right prompt in the line editor as given by RPS1 or RPROMPT and the right hand side of the screen. If not set, the value 1 is used.
Typically this will be used to set the value to 0 so that the prompt appears flush with the right hand side of the screen. This is not the default as many terminals do not handle this correctly, in particular when the prompt appears at the extreme bottom right of the screen. Recent virtual terminals are more likely to handle this case correctly.

Some experimentation is necessary.

@dritter
Copy link
Member

dritter commented Oct 11, 2015

For the protocol: There was an interesting conversation on the mailing list in late 2013 about how to simulate the behavior of ZLE_RPROMPT_INDENT. About the same time there was a bug report about that issue.

@bhilburn
Copy link
Member

@keirlawson - It's not just a problem with gnome-terminal - it actually exists in a every emulator I have used ZSH in, to date. As @dritter said, it seems to be a ZSH drawing issue.

@dritter - I don't think we can work around this safely in our theme, as it will change from emulator to emulator. Do you agree? If so, I'm afraid this bug is something we can't address.

@bhilburn
Copy link
Member

Unfortunately, I don't think this is something we can fix in our theme.

@Pk13055
Copy link

Pk13055 commented May 20, 2018

Is this something that still can't be fixed?

@dritter
Copy link
Member

dritter commented Jun 2, 2018

@Pk13055 Unfortunately not from our side. At least not easy. There are workarounds out there, but I haven't tested these in a long time.. Also, I haven't tried setting ZLE_RPROMPT_INDENT=0 since then. It might work for you. Did you try it out?

@softmoth
Copy link
Contributor

softmoth commented Jun 9, 2018

ZLE_RPROMPT_INDENT=-1 works in many cases. Give it a try.

@macserv
Copy link

macserv commented Apr 3, 2019

@softmoth Setting it to -1 works... but why? 😆 Might have to do some digging on that one.

Edit: It looks like the lack of empty space in the rightmost column confuses Terminal.app (macOS 10.14.4) when using GUI-level functions related to clearing text (e.g.: Clear to Start, Clear to Previous Mark, etc.)

Screen Shot 2019-04-03 at 12 52 06
Screen Shot 2019-04-03 at 12 56 26
Screen Shot 2019-04-03 at 12 59 18
Screen Shot 2019-04-03 at 13 00 10

@softmoth
Copy link
Contributor

softmoth commented Apr 3, 2019

@macserv, there's a workaround in #871. It's already added to powerlevel9k though, so you shouldn't be having the extra space.

@macserv
Copy link

macserv commented Apr 4, 2019

Ha! I thought something like that might be possible, but I was trying it with a null (\u0000), and that didn’t work.

Anyway, I haven’t pulled in a while, so I’ll check and see if that’s had an effect. Thanks!

katmfoo pushed a commit to katmfoo/dotfiles that referenced this issue Dec 2, 2019
When ZLE_RPROMPT_INDENT is 0, it offsets the right prompt and the cursor
by 1 (right prompt one to the right, cursor one to the left, not sure why
this is the behavior) which makes the cursor appear in the wrong place.
When you set it to -1 instead, it doesn't, figured this out from [1].

[1]: Powerlevel9k/powerlevel9k#110 (comment)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants