After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 158797 - VTE shows one pixel from previous line on top
VTE shows one pixel from previous line on top
Status: RESOLVED FIXED
Product: vte
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: VTE Maintainers
VTE Maintainers
Depends on:
Blocks:
 
 
Reported: 2004-11-20 09:06 UTC by Bernhard Walle
Modified: 2006-03-09 09:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
The screenshot (71.14 KB, image/png)
2004-11-20 09:06 UTC, Bernhard Walle
  Details
my screenshot (28.62 KB, image/png)
2005-01-14 23:38 UTC, Egmont Koblinger
  Details
a fix for the problems (1.03 KB, patch)
2005-01-15 01:37 UTC, Egmont Koblinger
none Details | Review

Description Bernhard Walle 2004-11-20 09:06:25 UTC
See the screenshot. It show's Terminal in use. It also happens on Gnome
Terminal. I use the VTE from CVS HEAD. The Font is "Xos4 Terminus".
Comment 1 Bernhard Walle 2004-11-20 09:06:50 UTC
Created attachment 33956 [details]
The screenshot
Comment 2 Egmont Koblinger 2005-01-14 22:34:52 UTC
I can confirm it. I use "Fixed Bold 12" font with LANG=hu_HU (which happens
to be different than the same font with en_US).

Note that the bug also occurs on the bottom of the screen, but it's slightly
harder to reproduce it since it needs a character that uses the topmost pixel
row of the cell (e.g. the vertical line of midnight command copy-pasted to
another file in UTF-8 mode, actually it is U+2502), and then we have to scroll
backwards (e.g. using the scrollbar).
Comment 3 Egmont Koblinger 2005-01-14 23:38:03 UTC
Ohhh, there's a more serious scrolling bug closely related to this one!

In src/vte.c there's a "#define VTE_PAD_WIDTH 1".

If you change it to 0, the 1 pixel border of the original window disappears,
so does the bug. However, the whole window somehow looks uglier IMHO.

Change this number to a bigger one, for example 5 (this number will be used in
my further examples). You'll not only more clearly see the original bug, but
you'll also see buggy content inside the terminal as soon as you start moving
the scrollbar with your mouse. In some of the rows the 5 topmost pixel rows
will simply be missing. Screenshot follows.

If you use the mouse wheel, you can see some logic in the behavior. The mouse
wheel always scrolls a half window. Create a long output, e.g. "ls -l /dev"
in a terminal with even number of rows. Scroll back several windows using the
mouse wheel. The bottom of the window always shows the top 5 pixel lines of the
row that's just been scrolled out. Now slowly start scrolling downwards. At the
fist step these 5 lines are correctly scrolled into the center of the screen,
so the screen is perfect, and the 5 pixel border doesn't contain any noise this
time. Scroll down once again. The bottom 5 black (oh, I mean, background color)
lines are scrolled onto the middle of the screen.
If the terminal has an odd number of lines, this only happens at every second
scroll. For even number of lines this happens at every consequent scroll.

I'm pretty sure that the original bug report and this one are very closely
related to each other and are probably caused by the same bug in the source.

Of course, needless to say, most likely this bug is also present in the default
VTE_PAD_WIDTH=1 case, it is only much harder to notice it.
Comment 4 Egmont Koblinger 2005-01-14 23:38:45 UTC
Created attachment 36038 [details]
my screenshot
Comment 5 Egmont Koblinger 2005-01-14 23:41:26 UTC
Oh, forgot to say: in all the cases the contents of the window is repaired
when it receives an expose event.
Comment 6 Egmont Koblinger 2005-01-15 01:37:54 UTC
Created attachment 36042 [details] [review]
a fix for the problems

Patch attached, tested, works for me, fixes all the issues mentioned in this
report.

There were three errors in the code.

1. Checking whether the topmost character row is being refreshed and hence the
border should also be included in the refresh area was faulty, it checked for
the value of the calculated pixel offset (rect.y) instead of the character row
(row_start).

2. Two vte_invalidate_cells() calls assumed that the 4th argument, the number
of the first row to be refreshed is counted according to the visible screen.
This is not true, the value should correspond to the row number in the whole
text buffer (including the scrollback region) since the implementation of this
functions substracts this number from its 4th argument.

3. Two vte_invalidate_cells() calls that should clear the border after
scrolling (what the original bugreport is about) were completely missing.

Notes:

Even with this patch pixels may flash up for a short time in the border. Just
set VTE_PAD_WIDTH to a large value (e.g. 50) and see it... Probably no-one
will ever notice it with a one-pixel border :-)

These pieces of code try do optimize things by scrolling the whole region of
the window. Since it can only be done with solid backgrounds, obviously a
different piece of code is executed when having a bitmap or transparent
background. That piece of code always redraws the screen, which seemed to be
only a little bit slower than this one. However, that code does not suffer from

any of these problems. So you can even get correct behaviour from vte without
this patch, just create a pixmap of your favorite color and set it as
background, or choose transparent background with maximum opacity.
Comment 7 Egmont Koblinger 2005-01-15 10:52:23 UTC
See also bug #164153.
The patch there obsoletes the second hunk of this patch.
Comment 8 Kjartan Maraas 2005-03-03 12:10:32 UTC
Then this probably also suffers from conflicts with recent patches that were
commited. Could we consolidate the remaining issues into one report maybe?
Comment 9 Egmont Koblinger 2005-04-27 10:43:32 UTC
The first hunk of my patch is still waiting to be applied, and it cleanly
applies to current 0.11.13. The rest is discussed in bug #164153.
Comment 10 Kjartan Maraas 2005-04-28 20:36:46 UTC
I'll try it on for size :-)
Comment 11 Kjartan Maraas 2005-04-28 20:44:16 UTC
I applied this to CVS head and rebuilt and I still see one pixel from the
previous line IFF I scroll down and the line has an underscore char on it. So
applying the first hunk of the patch doesn't seem to fix this entirely...
Comment 12 Egmont Koblinger 2005-04-29 08:00:53 UTC
The proper solution for the 'one pixel off' bug is in described bug #164153.
I don't think this particular small patch (the first hunk) fixes anything on its 
own, but looking at the source it's clearly false (it checks for something that 
is always false, perhaps someone simply mistyped the source, he typed the name 
of one variable while he thought of the other one.) A similar check near this 
one for the bottom of the screen is okay, this is a symmetric case for the top 
of the screen.
Comment 13 Egmont Koblinger 2006-03-07 16:58:28 UTC
Seems to me that with vte-0.11.20 (probably with an earlier version too)
this whole issue is completely fixed now, so this bug can be closed.

Bernhard (the original reporter), do you agree?
Comment 14 Behdad Esfahbod 2006-03-07 17:12:10 UTC
Yeah, I've not seen this for quite a while too.
Comment 15 Bernhard Walle 2006-03-09 09:55:41 UTC
Yes, seems to be fixed here, too.