Scrollbar flashes up when shrinking window with alternate screen
@egmontkob
Submitted by Egmont Koblinger Link to original bug (#709089)
Description
Switch to alternate screen, resize the window to contain fewer lines. Notice that the scrollbar(*) flashes up for a short time.
(*) I'm using Ubuntu 13.04's default desktop with its overlay scrollbar that's invisible when it can't scroll anything, that is, it should always be invisible with the alternate screen. Probably the glitch is less noticable with a regular scrollbar.
In vte_terminal_size_allocate() first we call vte_terminal_set_size() which figures out that a scrollbar is required now and schedules it to be displayed. It is followed by vte_terminal_set_scrollback_lines() which truncates the ring so that scrollbar is no longer required.
Not sure how it behaves / should behave when normal screen is on with scrolling restricted.
(I was about to add an assertion in vte_terminal_screen_set_size() that with the alternate screen we need to enter the "everything fits without scrollbars" branch, but right now this assertion doesn't hold.)
Technical thoughts:
I don't like the vte_terminal_queue_adjustment_value_changed() method. It makes it required that the screen's scroll_delta is set via a method and not directly, as opposed to all the other fields. Except when the screen is not the active one, see the ugly "if" branch at the end of vte_terminal_screen_set_size() (bug 415277's fix). It requires an ugly hack in bug 676075's fix. The design doesn't consider that the scrollbar is per-terminal while scroll_delta is per-screen.
The code cleanup I have in my mind is: Just set screen's scroll_delta directly. Have a copy in VteTermial which is for the actually displayed value. Have a method that updates the terminal's scroll_delta based on the active screen's scroll_delta and schedules a visual update if the value actually changed.
Version: 0.34.x