forked from qt-creator/qt-creator
FakeVim: Fix scrolling on small movement
Fixes scrolling to center text cursor on screen on j/k and h/l on last visible line. Change-Id: I65a1144a99f44a3df4217bc8eb6ee5ae6ef89ad4 Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -2145,7 +2145,7 @@ void FakeVimHandler::Private::leaveFakeVim(bool needUpdate)
|
|||||||
|
|
||||||
// Move cursor line to middle of screen if it's not visible.
|
// Move cursor line to middle of screen if it's not visible.
|
||||||
const int line = cursorLine();
|
const int line = cursorLine();
|
||||||
if (line < firstVisibleLine() || line >= firstVisibleLine() + linesOnScreen())
|
if (line < firstVisibleLine() || line > firstVisibleLine() + linesOnScreen())
|
||||||
scrollToLine(qMax(0, line - linesOnScreen() / 2));
|
scrollToLine(qMax(0, line - linesOnScreen() / 2));
|
||||||
else
|
else
|
||||||
scrollToLine(firstVisibleLine());
|
scrollToLine(firstVisibleLine());
|
||||||
@@ -2839,6 +2839,7 @@ void FakeVimHandler::Private::moveDown(int n)
|
|||||||
|
|
||||||
setPosition(position);
|
setPosition(position);
|
||||||
moveToTargetColumn();
|
moveToTargetColumn();
|
||||||
|
updateScrollOffset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FakeVimHandler::Private::movePageDown(int count)
|
void FakeVimHandler::Private::movePageDown(int count)
|
||||||
|
Reference in New Issue
Block a user