fakevim: use main editor selection

This commit is contained in:
hjk
2010-09-13 13:53:18 +02:00
parent fb05c7a9e2
commit 259c0c1d8e
3 changed files with 54 additions and 9 deletions

View File

@@ -501,6 +501,8 @@ private slots:
void findNext(bool reverse);
void showSettingsDialog();
void maybeReadVimRc();
void setBlockSelection(bool);
void hasBlockSelection(bool*);
void showCommandBuffer(const QString &contents);
void showExtraInformation(const QString &msg);
@@ -831,6 +833,10 @@ void FakeVimPluginPrivate::editorOpened(Core::IEditor *editor)
this, SLOT(indentRegion(int,int,QChar)));
connect(handler, SIGNAL(checkForElectricCharacter(bool*,QChar)),
this, SLOT(checkForElectricCharacter(bool*,QChar)));
connect(handler, SIGNAL(requestSetBlockSelection(bool)),
this, SLOT(setBlockSelection(bool)));
connect(handler, SIGNAL(requestHasBlockSelection(bool*)),
this, SLOT(hasBlockSelection(bool*)));
connect(handler, SIGNAL(completionRequested()),
this, SLOT(triggerCompletions()));
connect(handler, SIGNAL(windowCommandRequested(int)),
@@ -893,6 +899,24 @@ void FakeVimPluginPrivate::triggerCompletions()
// bt->triggerCompletions();
}
void FakeVimPluginPrivate::setBlockSelection(bool on)
{
FakeVimHandler *handler = qobject_cast<FakeVimHandler *>(sender());
if (!handler)
return;
if (BaseTextEditor *bt = qobject_cast<BaseTextEditor *>(handler->widget()))
bt->setBlockSelection(on);
}
void FakeVimPluginPrivate::hasBlockSelection(bool *on)
{
FakeVimHandler *handler = qobject_cast<FakeVimHandler *>(sender());
if (!handler)
return;
if (BaseTextEditor *bt = qobject_cast<BaseTextEditor *>(handler->widget()))
*on = bt->hasBlockSelection();
}
void FakeVimPluginPrivate::checkForElectricCharacter(bool *result, QChar c)
{
FakeVimHandler *handler = qobject_cast<FakeVimHandler *>(sender());