fakevim: provide a means to see configuration variables

This commit is contained in:
hjk
2009-01-09 15:36:02 +01:00
parent f3a0d9b4e0
commit 67f31135e5
4 changed files with 19 additions and 0 deletions

View File

@@ -59,6 +59,7 @@
#include <QtCore/QPoint> #include <QtCore/QPoint>
#include <QtCore/QSettings> #include <QtCore/QSettings>
#include <QtGui/QMessageBox>
#include <QtGui/QPlainTextEdit> #include <QtGui/QPlainTextEdit>
#include <QtGui/QTextBlock> #include <QtGui/QTextBlock>
#include <QtGui/QTextCursor> #include <QtGui/QTextCursor>
@@ -149,6 +150,8 @@ void FakeVimPlugin::installHandler()
if (!textEditor) if (!textEditor)
return; return;
connect(m_handler, SIGNAL(extraInformationChanged(QString)),
this, SLOT(showExtraInformation(QString)));
connect(m_handler, SIGNAL(commandBufferChanged(QString)), connect(m_handler, SIGNAL(commandBufferChanged(QString)),
this, SLOT(showCommandBuffer(QString))); this, SLOT(showCommandBuffer(QString)));
connect(m_handler, SIGNAL(quitRequested(QWidget *)), connect(m_handler, SIGNAL(quitRequested(QWidget *)),
@@ -171,6 +174,11 @@ void FakeVimPlugin::showCommandBuffer(const QString &contents)
tr("Quit FakeVim"), m_handler, SLOT(quit())); tr("Quit FakeVim"), m_handler, SLOT(quit()));
} }
void FakeVimPlugin::showExtraInformation(const QString &text)
{
QMessageBox::information(0, tr("FakeVim Information"), text);
}
//#include "fakevimplugin.moc" //#include "fakevimplugin.moc"

View File

@@ -82,6 +82,7 @@ private slots:
void installHandler(); void installHandler();
void removeHandler(QWidget *widget); void removeHandler(QWidget *widget);
void showCommandBuffer(const QString &contents); void showCommandBuffer(const QString &contents);
void showExtraInformation(const QString &msg);
private: private:
FakeVimHandler *m_handler; FakeVimHandler *m_handler;

View File

@@ -1004,6 +1004,7 @@ void FakeVimHandler::Private::handleExCommand(const QString &cmd0)
static QRegExp reWrite("^w!?( (.*))?$"); static QRegExp reWrite("^w!?( (.*))?$");
static QRegExp reDelete("^d( (.*))?$"); static QRegExp reDelete("^d( (.*))?$");
static QRegExp reSet("^set?( (.*))?$");
if (cmd.isEmpty()) { if (cmd.isEmpty()) {
m_tc.setPosition(positionForLine(beginLine)); m_tc.setPosition(positionForLine(beginLine));
@@ -1093,6 +1094,14 @@ void FakeVimHandler::Private::handleExCommand(const QString &cmd0)
redo(); redo();
enterCommandMode(); enterCommandMode();
updateMiniBuffer(); 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 { } else {
showRedMessage("E492: Not an editor command: " + cmd0); showRedMessage("E492: Not an editor command: " + cmd0);
} }

View File

@@ -66,6 +66,7 @@ public slots:
signals: signals:
void commandBufferChanged(const QString &msg); void commandBufferChanged(const QString &msg);
void statusDataChanged(const QString &msg); void statusDataChanged(const QString &msg);
void extraInformationChanged(const QString &msg);
void quitRequested(QWidget *); void quitRequested(QWidget *);
private: private: