Change Scroll Region and display glitch

Bug #246701 reported by Micah Cowan
4
Affects Status Importance Assigned to Milestone
Gnome Virtual Terminal Emulator
Fix Released
Medium
vte (Ubuntu)
Fix Released
Low
Ubuntu Desktop Bugs

Bug Description

Please describe the problem:
After sending CSR so that the final line in the terminal is excluded from the
scroll region, glitches can occur when interspersing writes to the bottom line
with scrolls of the upper region.

Steps to reproduce:
I will attach a script (scr-fix-min) that produces the problem for me.

NOTE: This script expects LINES and COLUMNS to be exported and refer to the number of
lines and columns in your terminal. These must be accurate or the bug won't be
shown. If they are unset, you will get a ton of errors, rather than the
simulation. If one is running bash, then

  $ export COLUMNS LINES
  $ ./scr-fix-min

will probably work. Otherwise, COLUMNS and LINES may need to be set explicitly before running the script.

Actual results:
What I currently see: one or both of "foo" and "bar" are missing. Or, on at
least one system, the bar will be black/empty when it ought to be
reversed/have-text.

Actually, when I _should_ see "foo" and "bar", but don't, I will sometimes
actually see an effect such that it looks like the top one or two pixel-rows of
the bottom line update and switch back, but not the rest of the line. So a
masking problem or incorrect information about what portions of the display to
update seem likely.

Expected results:
What you ought to see: the bottom bar flash between "x", "foo", "x", and "bar".

Does this happen every time?
This reproduces reliably for me on gnome-terminal. xfce4-terminal sometimes
shows both "foo" and "bar" as it ought to, and sometimes doesn't (same app,
same instance, different runs of script).

Other information:
This behavior was discovered while I was using screen, which can use the final
line as a "status" line. I was playing with screen's "autoaka" feature, which
allows the current screen window's name to change based on the
currently-running command: I found that everything worked as it should until
the prompt reached the bottom, so that hitting enter caused scrolling. At that
point, the window title would stop updating.

Tags: patch
Revision history for this message
Micah Cowan (micahcowan) wrote :
Revision history for this message
Micah Cowan (micahcowan) wrote :

See also the bugtracker for GNU Screen, where I discovered and analyzed the problem.

https://savannah.gnu.org/bugs/?23699

Changed in vte:
status: Unknown → New
Changed in vte:
assignee: nobody → desktop-bugs
importance: Undecided → Low
status: New → Triaged
Changed in vte:
importance: Unknown → Medium
Revision history for this message
Micah Cowan (micahcowan) wrote :

Found the source of the problem. The vte_terminal_process_incoming function from vte.c keeps track of a "bounding box" of cells to be invalidated, and uses that to invalidate cells at points such as after all input has been processed, or when a large enough cursor jump is made (to avoid letting the bounding box get needlessly large). This bounding box is represented in terms of the total number of lines in the terminal, including history. The problem that arises is that if a scroll takes place before the bounding box has been used to invalidate cells, then a new row is added to the total terminal rows, increasing the index number of the bottom rows. Thus, the bounding box will now be off by one (or however large the scroll is), and no longer reaches all the way to the bottom of the screen (if it did before). This problem applies, even when no scrollback history is enabled, as the relevant indexes all still increase, even though the true number of actual data rows hasn't changed.

The fix I implemented is to force invalidation to take place if we move into a scroll region from outside it.

Revision history for this message
Micah Cowan (micahcowan) wrote :
tags: added: patch
Revision history for this message
Micah Cowan (micahcowan) wrote :

Minor fix to patch; addresses the same problem in a few cases apparently not exercised by the automated script.

Revision history for this message
Micah Cowan (micahcowan) wrote :

(Please note: the debdiff above is now out-of-date; but can still be used, and then just replace the file in debian/patches.)

(There is also now a merge proposal against https://bazaar.launchpad.net/~ubuntu-desktop/vte/ubuntu/changes, which does use the updated patch.)

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package vte - 1:0.27.2-0ubuntu3

---------------
vte (1:0.27.2-0ubuntu3) natty; urgency=low

  * Fix update glitch related to scroll regions (LP: #246701)
 -- Micah Cowan <email address hidden> Fri, 17 Dec 2010 11:58:21 +1100

Changed in vte (Ubuntu):
status: Triaged → Fix Released
Revision history for this message
Micah Cowan (micahcowan) wrote :

The fix is now in place for the Ubuntu Natty, and it looks like upstream is going to include it for future versions of vte. Nice to finally be able to use gnome-terminal with screen and tmux without glitchy graphics :)

Note: at least one person had difficulty reproducing this on their system using the shell script I originally created; the linked Gnome bug report has an improved version attached, that allowed them to reproduce it more reliably.

Changed in vte:
status: New → Confirmed
Changed in vte:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.