yardnsm/blox-zsh-theme

Resizing the terminal causes lines to disappear

elldritch opened this issue · 11 comments

I use this theme with terminator, and opening a new terminal window below (using ctrl+O) often causes the previous terminal window to lose lines. I'm not totally sure what's causing this, but this problem doesn't occur with other zsh themes. I suspect it has to do with resizing code that clears too many lines.

Can you please upload some screenshots regarding this issue? Also, what do you mean by "resizing code that clears too many lines"?

Here's an example:

I start by executing a command that outputs some lines.

2017-05-25-005440_771x548_scrot

Then I press ctrl+O to split my terminal. This actually resizes the old terminal, and opens a new one below it.
2017-05-25-005452_766x540_scrot

Notice how some of the lines from the previous command's output are now gone. Now if I close the bottom terminal, which resizes the top one back to its original size, I see another weird effect.
2017-05-25-005658_764x542_scrot

I haven't looked at the internals of the theme at all, but my guess is that there's some code that's running every time the terminal is resized that is entering control sequences that cause this. This weird resizing effect also occurs while running interactive programs (e.g. vim or less) and makes some of those programs unusable after the terminal is resized.

Actually there isn't such a resize code, but I am doing some weird stuff there. I'm planning on a rewrite, so expect some updates soon.

Just updated the theme, this should be working fine now.

However, and I did notice it in other themes that has an upper right segment (such as bart), when resizing the terminal horizontally, things can get ugly:

screen shot 2017-06-09 at 15 33 19

If this bother you, you can set BLOX_SEG__UPPER_RIGHT to a blank array or set BLOX_CONF__ONELINE for a oneline prompt.

@yardnsm

things can get ugly

yeah, that's true.
export BLOX_SEG__UPPER_RIGHT=() doesn't work. I mean it looks weird event with this option. BLOX_CONF__ONELINE works but i want to use two lines without resizing glitch. Do you know a way to make this possible?

@avently It works fine for me for the following basic config:

BLOX_CONF__ONELINE=false
BLOX_SEG__UPPER_LEFT=(blox_block__cwd)
BLOX_SEG__UPPER_RIGHT=()

Can you upload a screenshot please?

You can reproduce it. Just choose directory with long name and make your terminal window slower than length of directory name.
screenshot-2017-10-24_035320_567778808

So i think we need to find another way to do things (not what you did in 14c75a8 )

The link was useful, the solution fixed the redrawing issue with the upper segments, but it still may redraw the lower left segment since I'm still setting PROMPT to show it (otherwise we would have a newline after the lower segments).

@yardnsm try to replace
RPROMPT='${lower_right}'
with this:
[[ $lower_right != " " ]] && RPROMPT='${lower_right}'

Because RPROMPT is the cause of that issue now. So, if a user doesn't use lower_right corner we don't need to use RPROMPT.
With our changes we get properly resizing window but not for guys who use lower_right corner and top_right corner is unresponsive to width changes (because ${spacing} is called only once).

So RPROMPT is set only if there's something in the lower right segment. About the "unresponsiveness" of the upper segments, I'll probably work on that sometime in the future.