forked from qt-creator/qt-creator
fakevim: work on autotests
This commit is contained in:
@@ -607,22 +607,28 @@ EventResult FakeVimHandler::Private::handleKey(int key, int unmodified,
|
|||||||
|
|
||||||
void FakeVimHandler::Private::moveDown(int n)
|
void FakeVimHandler::Private::moveDown(int n)
|
||||||
{
|
{
|
||||||
// m_tc.movePosition(Down, MoveAnchor, n); does not work for "hidden"
|
#if 0
|
||||||
// documents like in the autotests
|
// does not work for "hidden" documents like in the autotests
|
||||||
|
m_tc.movePosition(Down, MoveAnchor, n);
|
||||||
|
#else
|
||||||
const QTextBlock &block = m_tc.block();
|
const QTextBlock &block = m_tc.block();
|
||||||
const int col = m_tc.position() - block.position();
|
const int col = m_tc.position() - block.position();
|
||||||
const int line = block.blockNumber();
|
const int line = block.blockNumber();
|
||||||
const int pos = m_tc.document()->findBlockByNumber(line + n).position();
|
const int pos = m_tc.document()->findBlockByNumber(line + n).position();
|
||||||
setPosition(pos + qMin(block.length(), col));
|
setPosition(pos + qMin(block.length(), col));
|
||||||
setPosition(pos);
|
setPosition(pos);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void FakeVimHandler::Private::moveToEndOfLine()
|
void FakeVimHandler::Private::moveToEndOfLine()
|
||||||
{
|
{
|
||||||
// m_tc.movePosition(EndOfLine, MoveAnchor) does not work for "hidden"
|
#if 0
|
||||||
// documents like in the autotests
|
// does not work for "hidden" documents like in the autotests
|
||||||
|
m_tc.movePosition(EndOfLine, MoveAnchor);
|
||||||
|
#else
|
||||||
const QTextBlock &block = m_tc.block();
|
const QTextBlock &block = m_tc.block();
|
||||||
setPosition(block.position() + block.length() - 1);
|
setPosition(block.position() + block.length() - 1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void FakeVimHandler::Private::finishMovement(const QString &dotCommand)
|
void FakeVimHandler::Private::finishMovement(const QString &dotCommand)
|
||||||
|
@@ -30,6 +30,8 @@
|
|||||||
#include "fakevimhandler.h"
|
#include "fakevimhandler.h"
|
||||||
|
|
||||||
#include <QtCore/QSet>
|
#include <QtCore/QSet>
|
||||||
|
|
||||||
|
#include <QtGui/QTextEdit>
|
||||||
#include <QtGui/QPlainTextEdit>
|
#include <QtGui/QPlainTextEdit>
|
||||||
|
|
||||||
#include <QtTest/QtTest>
|
#include <QtTest/QtTest>
|
||||||
@@ -66,6 +68,7 @@ private:
|
|||||||
const char* file, int line);
|
const char* file, int line);
|
||||||
QString insertCursor(const QString &needle0);
|
QString insertCursor(const QString &needle0);
|
||||||
|
|
||||||
|
//QTextEdit m_editor;
|
||||||
QPlainTextEdit m_editor;
|
QPlainTextEdit m_editor;
|
||||||
FakeVimHandler m_handler;
|
FakeVimHandler m_handler;
|
||||||
QList<QTextEdit::ExtraSelection> m_selection;
|
QList<QTextEdit::ExtraSelection> m_selection;
|
||||||
|
Reference in New Issue
Block a user