diff options
author | hjk <qtc-committer@nokia.com> | 2009-01-27 13:23:02 +0100 |
---|---|---|
committer | hjk <qtc-committer@nokia.com> | 2009-01-27 13:23:02 +0100 |
commit | f449bc6f91a1e44237bc1ea9075b61862ed50405 (patch) | |
tree | 82184a006d53a6872256dbe90b2c20c562ff962d /src | |
parent | 21f15207fbc352604d25ac4f6770bf507e63a5b9 (diff) | |
download | qt-creator-f449bc6f91a1e44237bc1ea9075b61862ed50405.tar.gz |
Fixes: fakevim: fix cursor positioning after search
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/fakevim/fakevimhandler.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index b63ebd9062..65333413d2 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -1582,10 +1582,14 @@ void FakeVimHandler::Private::search(const QString &needle0, bool forward) if (forward) m_tc.movePosition(Right, MoveAnchor, 1); + int oldLine = cursorLineInDocument() - cursorLineOnScreen(); + EDITOR(setTextCursor(m_tc)); if (EDITOR(find(needle, flags))) { m_tc = EDITOR(textCursor()); m_tc.setPosition(m_tc.anchor()); + if (oldLine != cursorLineInDocument() - cursorLineOnScreen()) + scrollToLineInDocument(cursorLineInDocument() - linesOnScreen() / 2); return; } @@ -1594,6 +1598,8 @@ void FakeVimHandler::Private::search(const QString &needle0, bool forward) if (EDITOR(find(needle, flags))) { m_tc = EDITOR(textCursor()); m_tc.setPosition(m_tc.anchor()); + if (oldLine != cursorLineInDocument() - cursorLineOnScreen()) + scrollToLineInDocument(cursorLineInDocument() - linesOnScreen() / 2); if (forward) showRedMessage("search hit BOTTOM, continuing at TOP"); else |