Commit 67f31135 authored by hjk's avatar hjk
Browse files

fakevim: provide a means to see configuration variables

parent f3a0d9b4
......@@ -59,6 +59,7 @@
#include <QtCore/QPoint>
#include <QtCore/QSettings>
#include <QtGui/QMessageBox>
#include <QtGui/QPlainTextEdit>
#include <QtGui/QTextBlock>
#include <QtGui/QTextCursor>
......@@ -149,6 +150,8 @@ void FakeVimPlugin::installHandler()
if (!textEditor)
return;
connect(m_handler, SIGNAL(extraInformationChanged(QString)),
this, SLOT(showExtraInformation(QString)));
connect(m_handler, SIGNAL(commandBufferChanged(QString)),
this, SLOT(showCommandBuffer(QString)));
connect(m_handler, SIGNAL(quitRequested(QWidget *)),
......@@ -171,6 +174,11 @@ void FakeVimPlugin::showCommandBuffer(const QString &contents)
tr("Quit FakeVim"), m_handler, SLOT(quit()));
}
void FakeVimPlugin::showExtraInformation(const QString &text)
{
QMessageBox::information(0, tr("FakeVim Information"), text);
}
//#include "fakevimplugin.moc"
......
......@@ -82,6 +82,7 @@ private slots:
void installHandler();
void removeHandler(QWidget *widget);
void showCommandBuffer(const QString &contents);
void showExtraInformation(const QString &msg);
private:
FakeVimHandler *m_handler;
......
......@@ -1004,6 +1004,7 @@ void FakeVimHandler::Private::handleExCommand(const QString &cmd0)
static QRegExp reWrite("^w!?( (.*))?$");
static QRegExp reDelete("^d( (.*))?$");
static QRegExp reSet("^set?( (.*))?$");
if (cmd.isEmpty()) {
m_tc.setPosition(positionForLine(beginLine));
......@@ -1093,6 +1094,14 @@ void FakeVimHandler::Private::handleExCommand(const QString &cmd0)
redo();
enterCommandMode();
updateMiniBuffer();
} else if (reSet.indexIn(cmd) != -1) { // :set
QString arg = reSet.cap(2);
if (arg.isEmpty()) {
QString info;
foreach (const QString &key, m_config.keys())
info += key + ": " + m_config.value(key) + "\n";
emit q->extraInformationChanged(info);
}
} else {
showRedMessage("E492: Not an editor command: " + cmd0);
}
......
......@@ -66,6 +66,7 @@ public slots:
signals:
void commandBufferChanged(const QString &msg);
void statusDataChanged(const QString &msg);
void extraInformationChanged(const QString &msg);
void quitRequested(QWidget *);
private:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment