[PATCH] Shift+PgUp if nr of scrolled lines is < 4

From: Egmont Koblinger
Date: Sat Jun 12 2004 - 15:15:30 EST


Hi,

Using the vga console driver, if the number of the lines scrolled out is
less than four, then Shift+PageUp doesn't work.

The bug is closely related to the 'margin' feature of scrolling, which
means that if less than four lines should remain unvisible in the
direction we are scrolling to, then we scroll a little bit more just to
see those few lines. Kind of two small magnets at the borders of the
buffer.

This bug was also reported with maybe a less clear description by Stepan
Koltsov (cc'ed just for fun) back in 2001 and he got no answer. I found it
at http://seclists.org/lists/linux-kernel/2001/Nov/0080.html

His patch simply disables margin support and hence everythings becomes
okay, but you lose a nice feature.

Here's a patch that retains margin support and fixes the bug. Works for
me, tested for a week. No guarantee. As I don't fully understand the code
(see also my previous mail) I'm not 100% sure that I'm doing the right
thing, so I'd prefer if someone would take a closer look at it.

At least 2.4 and 2.6 are affected, maybe older ones too.


--- linux-2.6.7-rc2.orig/drivers/video/console/vgacon.c 2004-05-30 08:26:09.000000000 +0200
+++ linux-2.6.7-rc2/drivers/video/console/vgacon.c 2004-06-06 00:31:29.829267377 +0200
@@ -963,6 +963,7 @@
p = (c->vc_visible_origin - vga_vram_base - ul + we) % we +
lines * c->vc_size_row;
st = (c->vc_origin - vga_vram_base - ul + we) % we;
+ if (st < 2 * margin) margin = 0;
if (p < margin)
p = 0;
if (p > st - margin)



bye,

Egmont
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/