From: Egmont Koblinger 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. Signed-off-by: Andrew Morton --- 25-akpm/drivers/video/console/vgacon.c | 2 ++ 1 files changed, 2 insertions(+) diff -puN drivers/video/console/vgacon.c~shiftpgup-if-nr-of-scrolled-lines-is-4 drivers/video/console/vgacon.c --- 25/drivers/video/console/vgacon.c~shiftpgup-if-nr-of-scrolled-lines-is-4 2004-06-12 17:21:04.464073208 -0700 +++ 25-akpm/drivers/video/console/vgacon.c 2004-06-12 17:21:20.957565816 -0700 @@ -963,6 +963,8 @@ static int vgacon_scrolldelta(struct vc_ 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) _