FakeVim: Monitor external cursor movement only with FakeVim enabled

Task-number: QTCREATORBUG-13443
Change-Id: I2f8ecb92599c59e31fc931557d4bc7a6b7e306af
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
Lukas Holecek
2014-11-18 20:02:22 +01:00
committed by hjk
parent c50487fc9a
commit e0acc42649
2 changed files with 6 additions and 2 deletions

View File

@@ -2312,7 +2312,6 @@ FakeVimHandler::Private::Private(FakeVimHandler *parent, QWidget *widget)
connect(EDITOR(document()), SIGNAL(contentsChange(int,int,int)), connect(EDITOR(document()), SIGNAL(contentsChange(int,int,int)),
SLOT(onContentsChanged(int,int,int))); SLOT(onContentsChanged(int,int,int)));
connect(EDITOR(document()), SIGNAL(undoCommandAdded()), SLOT(onUndoCommandAdded())); connect(EDITOR(document()), SIGNAL(undoCommandAdded()), SLOT(onUndoCommandAdded()));
connect(editor(), SIGNAL(cursorPositionChanged()), SLOT(onCursorPositionChanged()));
m_buffer->lastRevision = revision(); m_buffer->lastRevision = revision();
} }
} }
@@ -2341,7 +2340,6 @@ void FakeVimHandler::Private::init()
initSingleShotTimer(&m_inputTimer, 1000, this, SLOT(onInputTimeout())); initSingleShotTimer(&m_inputTimer, 1000, this, SLOT(onInputTimeout()));
pullOrCreateBufferData(); pullOrCreateBufferData();
pullCursor();
setupCharClass(); setupCharClass();
} }
@@ -2558,6 +2556,10 @@ void FakeVimHandler::Private::removeEventFilter()
void FakeVimHandler::Private::setupWidget() void FakeVimHandler::Private::setupWidget()
{ {
m_cursorNeedsUpdate = true;
connect(editor(), SIGNAL(cursorPositionChanged()),
SLOT(onCursorPositionChanged()), Qt::UniqueConnection);
enterFakeVim(); enterFakeVim();
leaveCurrentMode(); leaveCurrentMode();
@@ -2681,6 +2683,7 @@ void FakeVimHandler::Private::restoreWidget(int tabSize)
setThinCursor(); setThinCursor();
updateSelection(); updateSelection();
updateHighlights(); updateHighlights();
disconnect(editor(), SIGNAL(cursorPositionChanged()), this, SLOT(onCursorPositionChanged()));
} }
EventResult FakeVimHandler::Private::handleKey(const Input &input) EventResult FakeVimHandler::Private::handleKey(const Input &input)

View File

@@ -2273,6 +2273,7 @@ void FakeVimPlugin::setupTest(QString *title, FakeVimHandler **handler, QWidget
Core::EditorManager::activateEditor(iedit); Core::EditorManager::activateEditor(iedit);
*edit = iedit->widget(); *edit = iedit->widget();
*handler = d->m_editorToHandler.value(iedit, 0); *handler = d->m_editorToHandler.value(iedit, 0);
(*handler)->setupWidget();
(*handler)->handleCommand(_("set startofline")); (*handler)->handleCommand(_("set startofline"));
// *handler = 0; // *handler = 0;