You are not logged in.

#1 2013-03-17 23:30:22

ayekat
Member
Registered: 2011-01-17
Posts: 1,359
Website

[SOLVED] zsh - lots of blank space upon resizing VTE based terminals

Note: I haven't followed of this matter any further after I had switched to urxvt, but a recent try with zsh and sakura shows me that this issue seems to be solved.

Hello

I have an issue that is rendering me sleepless these days. It's about zsh and its behaviour when being run inside a VTE based terminal (e.g. gnome-terminal, xfce4-terminal, roxterm, sakura, ...).

When I increase the terminal height, if the buffer exceeds the window height, the content above won't get correctly shifted down, but simply blank space is added at the bottom.

On the contrary, when I decrease the terminal height, it does not simply remove the blank space at the bottom, but instead shifts up the buffer, keeping the blank space.

This is quite annoying, because everytime I resize my windows (which happens quite often, as I'm in a tiling WM), I find myself scrolling up in order to see older output because there's only one line remaining. And even worse, as I start typing, it all scrolls back down, even though I type within the visible area.

This does not happen upon running another shell (bash, dash), or zsh in a non-VTE terminal (urxvt, xterm), however I'd like to stay with zsh and xfce4-terminal (as I'm having lots of other issues with urxvt).

After hours of googling, I haven't found any entry about a similar problem, which I find slightly confusing, since one of my friends has exactly the same behaviour with xfce4-terminal and zsh (he just hasn't noticed until I asked him, as he doesn't resize his terminal windows that often).

My question(s):
Does anybody else use zsh in a VTE-based terminal? And if so, do you get the same behaviour? And if not, could you help me out with your configuration?

Last edited by ayekat (2016-02-16 16:30:54)


{,META,RE}PKGBUILDSpacman-hacks (includes makemetapkg and remakepkg) │ dotfiles

Offline

#2 2013-03-20 07:00:23

linvinus
Member
Registered: 2013-03-20
Posts: 10

Re: [SOLVED] zsh - lots of blank space upon resizing VTE based terminals

i can confirm!
on ubuntu the same problem, any resize of vte terminal breaks lines.
does not depend on any of the config settings or prompt theme.

Last edited by linvinus (2013-03-20 07:57:16)


AltYo - drop-down terminal, unique multi-line tabs and many other features https://github.com/linvinus/AltYo (based on Gtk3 libvte, written in vala) License GPL3+

Offline

#3 2013-03-20 07:52:52

linvinus
Member
Registered: 2013-03-20
Posts: 10

Re: [SOLVED] zsh - lots of blank space upon resizing VTE based terminals

i found how to reproduce same bug in bash.

The problem in escape sequence \033[J
default zsh prompt print "\033[0m\033[27m\033[24m\033[Jlinuxbox%"
if i add \033[J to bash PS1 i get same problems in vte terminals. (for example PS1='\033[J\u@\h:\w\$ ')

according to http://www.termsys.demon.co.uk/vtansi.htm

Erase Down		<ESC>[J

    Erases the screen from the current line down to the bottom of the screen.

vte function for that vte_sequence_handler_cd

but problem is in vte_terminal_set_size
at delta calculation

Last edited by linvinus (2013-03-20 14:01:18)


AltYo - drop-down terminal, unique multi-line tabs and many other features https://github.com/linvinus/AltYo (based on Gtk3 libvte, written in vala) License GPL3+

Offline

#4 2013-03-20 18:06:09

linvinus
Member
Registered: 2013-03-20
Posts: 10

Re: [SOLVED] zsh - lots of blank space upon resizing VTE based terminals

Patch that resolve resizing problems.
zsh prompt themes adam1,adam2 have bug when resize terminal, others working fine

diff --git a/src/vte.c b/src/vte.c
index fe49088..fd1a1fd 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -8019,9 +8019,10 @@ vte_terminal_set_size(VteTerminal *terminal, glong columns, glong rows)
        if (old_rows != terminal->row_count || old_columns != terminal->column_count) {
                VteScreen *screen = terminal->pvt->screen;
                glong visible_rows = MIN (old_rows, _vte_ring_length (screen->row_data));
-               if (terminal->row_count < visible_rows) {
-                       glong delta = visible_rows - terminal->row_count;
-                       screen->insert_delta += delta;
+               glong ring_length=_vte_ring_length (screen->row_data);
+               glong delta = visible_rows - terminal->row_count;
+               if (screen->cursor_current.row+delta>(ring_length-1) && terminal->row_count < visible_rows) {
+                       screen->insert_delta += (screen->cursor_current.row+delta-(ring_length-1));
                        vte_terminal_queue_adjustment_value_changed (
                                        terminal,
                                        screen->scroll_delta + delta);

for ubuntu patched libvte available in this ppa https://launchpad.net/~linvinus/+archive/vte

Last edited by linvinus (2013-03-22 06:18:04)


AltYo - drop-down terminal, unique multi-line tabs and many other features https://github.com/linvinus/AltYo (based on Gtk3 libvte, written in vala) License GPL3+

Offline

#5 2013-03-21 00:36:06

ayekat
Member
Registered: 2011-01-17
Posts: 1,359
Website

Re: [SOLVED] zsh - lots of blank space upon resizing VTE based terminals

Hey

Thanks for your answers! Although I have no <ESC>[J in zsh PS1... but I'm going to try this patch anyway and see if it solves my problem.
I'll be back with more information tomorrow.

In any case, this is great!


{,META,RE}PKGBUILDSpacman-hacks (includes makemetapkg and remakepkg) │ dotfiles

Offline

#6 2013-03-21 05:50:24

linvinus
Member
Registered: 2013-03-20
Posts: 10

Re: [SOLVED] zsh - lots of blank space upon resizing VTE based terminals

ayekat wrote:

Hey

Thanks for your answers! Although I have no <ESC>[J in zsh PS1... but I'm going to try this patch anyway and see if it solves my problem.
I'll be back with more information tomorrow.

in zsh it hardcoded,
you can check that if you run zsh inside script (script — make typescript of terminal session)

Last edited by linvinus (2013-03-21 09:35:29)


AltYo - drop-down terminal, unique multi-line tabs and many other features https://github.com/linvinus/AltYo (based on Gtk3 libvte, written in vala) License GPL3+

Offline

#7 2013-03-21 08:35:14

linvinus
Member
Registered: 2013-03-20
Posts: 10

Re: [SOLVED] zsh - lots of blank space upon resizing VTE based terminals

and finally i found what is wrong with adam2 theme in zsh when resizing.

when size of first prompt line is equal to terminal width , then when size of terminal changes, zsh add \033[A twice  (but should once)
as the result new promp is one line up to previous position

workaround is simple, add
prompt_padding_size=$((prompt_padding_size - 1))
after prompt_padding_size was calculated.

Last edited by linvinus (2013-03-21 09:50:18)


AltYo - drop-down terminal, unique multi-line tabs and many other features https://github.com/linvinus/AltYo (based on Gtk3 libvte, written in vala) License GPL3+

Offline

#8 2013-03-21 09:53:47

ayekat
Member
Registered: 2011-01-17
Posts: 1,359
Website

Re: [SOLVED] zsh - lots of blank space upon resizing VTE based terminals

linvinus wrote:

in zsh it hardcoded,
you can check that if you run zsh inside script (script — make typescript of terminal session)

Oh, you're right. It always prints \e[J before printing a new prompt. I suppose this is due to the 'suggestions-below-the-prompt' thing.
Thanks for the script command. I learn something new every day ^^

Now I applied the patch and it works for one half of the problem:

When I decrease the window size, it correctly eats up the blank space at the bottom (so the text no longer gets pushed upwards).
However, when I increase the window size, it still adds blank space to the bottom. So basically once a window has been sized down to, say, 10 rows, it will always stay at those 10 rows (except of course there's some new output).

However I just saw that that I've patched the GTK2 version of VTE, perhaps it's better with the vte3 package.
... this also explains why some terminals like xfce4-terminal and lxterminal behave as described above, while others like gnome-terminal or roxterm just continue bugging.

Again, thank you!
I'll try this afternoon if it works with the vte3 package.


{,META,RE}PKGBUILDSpacman-hacks (includes makemetapkg and remakepkg) │ dotfiles

Offline

#9 2013-03-21 10:03:06

linvinus
Member
Registered: 2013-03-20
Posts: 10

Re: [SOLVED] zsh - lots of blank space upon resizing VTE based terminals

ayekat wrote:
linvinus wrote:

in zsh it hardcoded,
you can check that if you run zsh inside script (script — make typescript of terminal session)

Oh, you're right. It always prints \e[J before printing a new prompt. I suppose this is due to the 'suggestions-below-the-prompt' thing.
Thanks for the script command. I learn something new every day ^^

Now I applied the patch and it works for one half of the problem:

When I decrease the window size, it correctly eats up the blank space at the bottom (so the text no longer gets pushed upwards).
However, when I increase the window size, it still adds blank space to the bottom. So basically once a window has been sized down to, say, 10 rows, it will always stay at those 10 rows (except of course there's some new output).

i think this is normal, but may be you are right.
i will see what can be done better.

ayekat wrote:

However I just saw that that I've patched the GTK2 version of VTE, perhaps it's better with the vte3 package.

no it will the same.

ayekat wrote:

... this also explains why some terminals like xfce4-terminal and lxterminal behave as described above, while others like gnome-terminal or roxterm just continue bugging.

Again, thank you!
I'll try this afternoon if it works with the vte3 package.

no problem


AltYo - drop-down terminal, unique multi-line tabs and many other features https://github.com/linvinus/AltYo (based on Gtk3 libvte, written in vala) License GPL3+

Offline

#10 2013-03-21 12:35:43

ayekat
Member
Registered: 2011-01-17
Posts: 1,359
Website

Re: [SOLVED] zsh - lots of blank space upon resizing VTE based terminals

OK, you were right again - doesn't make any difference whether it's the GTK2 or GTK3 version of VTE.


{,META,RE}PKGBUILDSpacman-hacks (includes makemetapkg and remakepkg) │ dotfiles

Offline

#11 2013-09-17 09:32:42

linvinus
Member
Registered: 2013-03-20
Posts: 10

Re: [SOLVED] zsh - lots of blank space upon resizing VTE based terminals

I created a bug report about this bug https://bugzilla.gnome.org/show_bug.cgi?id=708213


AltYo - drop-down terminal, unique multi-line tabs and many other features https://github.com/linvinus/AltYo (based on Gtk3 libvte, written in vala) License GPL3+

Offline

Board footer

Powered by FluxBB