forked from qt-creator/qt-creator
FakeVim: Disable cursor blinking by default
Add an option to enable Task-number: QTCREATORBUG-21613 Change-Id: Ia0553f0b89b22c1d5b47487cd6e5b3c3a523cd6d Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -108,6 +108,7 @@ FakeVimSettings::FakeVimSettings()
|
|||||||
createAction(ConfigTildeOp, false, "TildeOp", "top");
|
createAction(ConfigTildeOp, false, "TildeOp", "top");
|
||||||
createAction(ConfigShowCmd, true, "ShowCmd", "sc");
|
createAction(ConfigShowCmd, true, "ShowCmd", "sc");
|
||||||
createAction(ConfigRelativeNumber, false, "RelativeNumber", "rnu");
|
createAction(ConfigRelativeNumber, false, "RelativeNumber", "rnu");
|
||||||
|
createAction(ConfigBlinkingCursor, false, "BlinkingCursor", "cb");
|
||||||
createAction(ConfigScrollOff, 0, "ScrollOff", "so");
|
createAction(ConfigScrollOff, 0, "ScrollOff", "so");
|
||||||
createAction(ConfigBackspace, QString("indent,eol,start"), "ConfigBackspace", "bs");
|
createAction(ConfigBackspace, QString("indent,eol,start"), "ConfigBackspace", "bs");
|
||||||
createAction(ConfigIsKeyword, QString("@,48-57,_,192-255,a-z,A-Z"), "IsKeyword", "isk");
|
createAction(ConfigIsKeyword, QString("@,48-57,_,192-255,a-z,A-Z"), "IsKeyword", "isk");
|
||||||
|
@@ -106,7 +106,9 @@ enum FakeVimSettingsCode
|
|||||||
ConfigClipboard,
|
ConfigClipboard,
|
||||||
ConfigShowCmd,
|
ConfigShowCmd,
|
||||||
ConfigScrollOff,
|
ConfigScrollOff,
|
||||||
ConfigRelativeNumber
|
ConfigRelativeNumber,
|
||||||
|
|
||||||
|
ConfigBlinkingCursor
|
||||||
};
|
};
|
||||||
|
|
||||||
class FakeVimSettings
|
class FakeVimSettings
|
||||||
|
@@ -130,6 +130,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="8" column="0">
|
||||||
|
<widget class="QCheckBox" name="checkBoxBlinkingCursor">
|
||||||
|
<property name="text">
|
||||||
|
<string>Blinking cursor</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="5" column="1">
|
<item row="5" column="1">
|
||||||
<widget class="QCheckBox" name="checkBoxShowMarks">
|
<widget class="QCheckBox" name="checkBoxShowMarks">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@@ -83,6 +83,7 @@
|
|||||||
#include <QAbstractTableModel>
|
#include <QAbstractTableModel>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
#include <QGuiApplication>
|
||||||
#include <QItemDelegate>
|
#include <QItemDelegate>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QPlainTextEdit>
|
#include <QPlainTextEdit>
|
||||||
@@ -91,6 +92,7 @@
|
|||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QStackedWidget>
|
#include <QStackedWidget>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
|
#include <QStyleHints>
|
||||||
#include <QTextBlock>
|
#include <QTextBlock>
|
||||||
#include <QTextCursor>
|
#include <QTextCursor>
|
||||||
#include <QTextEdit>
|
#include <QTextEdit>
|
||||||
@@ -426,6 +428,7 @@ QWidget *FakeVimOptionPage::widget()
|
|||||||
m_group.insert(theFakeVimSetting(ConfigShowCmd), m_ui.checkBoxShowCmd);
|
m_group.insert(theFakeVimSetting(ConfigShowCmd), m_ui.checkBoxShowCmd);
|
||||||
|
|
||||||
m_group.insert(theFakeVimSetting(ConfigRelativeNumber), m_ui.checkBoxRelativeNumber);
|
m_group.insert(theFakeVimSetting(ConfigRelativeNumber), m_ui.checkBoxRelativeNumber);
|
||||||
|
m_group.insert(theFakeVimSetting(ConfigBlinkingCursor), m_ui.checkBoxBlinkingCursor);
|
||||||
|
|
||||||
connect(m_ui.pushButtonCopyTextEditorSettings, &QAbstractButton::clicked,
|
connect(m_ui.pushButtonCopyTextEditorSettings, &QAbstractButton::clicked,
|
||||||
this, &FakeVimOptionPage::copyTextEditorSettings);
|
this, &FakeVimOptionPage::copyTextEditorSettings);
|
||||||
@@ -529,6 +532,7 @@ public:
|
|||||||
void fold(FakeVimHandler *handler, int depth, bool fold);
|
void fold(FakeVimHandler *handler, int depth, bool fold);
|
||||||
void maybeReadVimRc();
|
void maybeReadVimRc();
|
||||||
void setShowRelativeLineNumbers(const QVariant &value);
|
void setShowRelativeLineNumbers(const QVariant &value);
|
||||||
|
void updateCursorBlinking(const QVariant &value);
|
||||||
|
|
||||||
void resetCommandBuffer();
|
void resetCommandBuffer();
|
||||||
void showCommandBuffer(FakeVimHandler *handler, const QString &contents,
|
void showCommandBuffer(FakeVimHandler *handler, const QString &contents,
|
||||||
@@ -569,6 +573,8 @@ public:
|
|||||||
|
|
||||||
MiniBuffer *m_miniBuffer = nullptr;
|
MiniBuffer *m_miniBuffer = nullptr;
|
||||||
FakeVimPluginRunData *runData = nullptr;
|
FakeVimPluginRunData *runData = nullptr;
|
||||||
|
|
||||||
|
int m_savedCursorFlashTime = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
@@ -1223,6 +1229,8 @@ bool FakeVimPluginPrivate::initialize()
|
|||||||
this, &FakeVimPluginPrivate::maybeReadVimRc);
|
this, &FakeVimPluginPrivate::maybeReadVimRc);
|
||||||
connect(theFakeVimSetting(ConfigRelativeNumber), &SavedAction::valueChanged,
|
connect(theFakeVimSetting(ConfigRelativeNumber), &SavedAction::valueChanged,
|
||||||
this, &FakeVimPluginPrivate::setShowRelativeLineNumbers);
|
this, &FakeVimPluginPrivate::setShowRelativeLineNumbers);
|
||||||
|
connect(theFakeVimSetting(ConfigBlinkingCursor), &SavedAction::valueChanged,
|
||||||
|
this, &FakeVimPluginPrivate::updateCursorBlinking);
|
||||||
|
|
||||||
// Delayed operations.
|
// Delayed operations.
|
||||||
connect(this, &FakeVimPluginPrivate::delayedQuitRequested,
|
connect(this, &FakeVimPluginPrivate::delayedQuitRequested,
|
||||||
@@ -1235,6 +1243,8 @@ bool FakeVimPluginPrivate::initialize()
|
|||||||
maybeReadVimRc();
|
maybeReadVimRc();
|
||||||
// << "MODE: " << theFakeVimSetting(ConfigUseFakeVim)->value();
|
// << "MODE: " << theFakeVimSetting(ConfigUseFakeVim)->value();
|
||||||
|
|
||||||
|
updateCursorBlinking(theFakeVimSetting(ConfigBlinkingCursor)->value());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1854,6 +1864,7 @@ void FakeVimPluginPrivate::setUseFakeVim(const QVariant &value)
|
|||||||
Find::setUseFakeVim(on);
|
Find::setUseFakeVim(on);
|
||||||
setUseFakeVimInternal(on);
|
setUseFakeVimInternal(on);
|
||||||
setShowRelativeLineNumbers(theFakeVimSetting(ConfigRelativeNumber)->value());
|
setShowRelativeLineNumbers(theFakeVimSetting(ConfigRelativeNumber)->value());
|
||||||
|
updateCursorBlinking(theFakeVimSetting(ConfigBlinkingCursor)->value());
|
||||||
}
|
}
|
||||||
|
|
||||||
void FakeVimPluginPrivate::setUseFakeVimInternal(bool on)
|
void FakeVimPluginPrivate::setUseFakeVimInternal(bool on)
|
||||||
@@ -1884,6 +1895,15 @@ void FakeVimPluginPrivate::setShowRelativeLineNumbers(const QVariant &value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FakeVimPluginPrivate::updateCursorBlinking(const QVariant &value)
|
||||||
|
{
|
||||||
|
if (m_savedCursorFlashTime == 0)
|
||||||
|
m_savedCursorFlashTime = QGuiApplication::styleHints()->cursorFlashTime();
|
||||||
|
|
||||||
|
bool blink = value.toBool() || !theFakeVimSetting(ConfigUseFakeVim)->value().toBool();
|
||||||
|
QGuiApplication::styleHints()->setCursorFlashTime(blink ? m_savedCursorFlashTime : 0);
|
||||||
|
}
|
||||||
|
|
||||||
void FakeVimPluginPrivate::handleExCommand(FakeVimHandler *handler, bool *handled, const ExCommand &cmd)
|
void FakeVimPluginPrivate::handleExCommand(FakeVimHandler *handler, bool *handled, const ExCommand &cmd)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(handler, return);
|
QTC_ASSERT(handler, return);
|
||||||
|
Reference in New Issue
Block a user