From 6d8223517fe0e99e1150a4a087ec36c77272750c Mon Sep 17 00:00:00 2001
From: hjk <qtc-committer@nokia.com>
Date: Wed, 25 Mar 2009 15:17:58 +0100
Subject: [PATCH] fakevim: more vim-ish behaviour of page up and down

---
 src/plugins/fakevim/fakevimhandler.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp
index 743abdb1f2a..0142dca7235 100644
--- a/src/plugins/fakevim/fakevimhandler.cpp
+++ b/src/plugins/fakevim/fakevimhandler.cpp
@@ -1417,10 +1417,14 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
         recordInsertText(str);
         recordEndGroup();
     } else if (key == Key_PageDown || key == control('f')) {
-        moveDown(count() * (linesOnScreen() - 2));
+        moveDown(count() * (linesOnScreen() - 2) - cursorLineOnScreen());
+        scrollToLineInDocument(cursorLineInDocument());
+        moveToFirstNonBlankOnLine();
         finishMovement();
     } else if (key == Key_PageUp || key == control('b')) {
-        moveUp(count() * (linesOnScreen() - 2));
+        moveUp(count() * (linesOnScreen() - 2) + cursorLineOnScreen());
+        scrollToLineInDocument(cursorLineInDocument() + linesOnScreen() - 2);
+        moveToFirstNonBlankOnLine();
         finishMovement();
     } else if (key == Key_Delete) {
         setAnchor();
-- 
GitLab