Commit f7c3b552 authored by hjk's avatar hjk
Browse files

fakevim: progress on settings

parent e346c0d7
......@@ -98,6 +98,11 @@ SavedAction *FakeVimSettings::item(int code)
return m_items.value(code, 0);
}
SavedAction *FakeVimSettings::item(const QString &name)
{
return m_items.value(m_nameToCode.value(name, -1), 0);
}
FakeVimSettings *theFakeVimSettings()
{
static FakeVimSettings *instance = 0;
......
......@@ -1794,33 +1794,33 @@ void FakeVimHandler::Private::handleExCommand(const QString &cmd0)
updateMiniBuffer();
} else if (reSet.indexIn(cmd) != -1) { // :set
QString arg = reSet.cap(2);
SavedAction *act = theFakeVimSettings()->item(arg);
if (arg.isEmpty()) {
theFakeVimSetting(SettingsDialog)->trigger(QVariant());
/*
} else if (theFakeVimSettings()->.contains(arg)) {
// boolean config to be switched on or non-boolean to show
QString oldValue = m_config.value(arg);
} else if (act && act->value().type() == QVariant::Bool) {
// boolean config to be switched on
bool oldValue = act->value().toBool();
if (oldValue == false)
m_config[arg] = true;
act->setValue(true);
else if (oldValue == true)
; // nothing to do
else
showBlackMessage(arg + '=' + oldValue);
} else if (arg.startsWith("no") && m_config.contains(arg.mid(2))) {
{} // nothing to do
} else if (act) {
// non-boolean to show
showBlackMessage(arg + '=' + act->value().toString());
} else if (arg.startsWith("no")
&& (act = theFakeVimSettings()->item(arg.mid(2)))) {
// boolean config to be switched off
QString key = arg.mid(2);
QString oldValue = m_config.value(key);
bool oldValue = act->value().toBool();
if (oldValue == true)
m_config[key] = false;
act->setValue(false);
else if (oldValue == false)
; // nothing to do
else
showBlackMessage(key + '=' + oldValue);
{} // nothing to do
} else if (arg.contains('=')) {
// non-boolean config to set
int p = arg.indexOf('=');
m_config[arg.left(p)] = arg.mid(p + 1);
*/
act = theFakeVimSettings()->item(arg.left(p));
if (act)
act->setValue(arg.mid(p + 1));
} else {
showRedMessage(tr("E512: Unknown option: ") + arg);
}
......
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