forked from qt-creator/qt-creator
fakevim: Show current command in minibuffer (showcmd option)
Use showcmd Vim option to show current partial command. Removed unneeded updateMiniBuffer() calls. Change-Id: Iddacd364b7c92882b6169a6894c89cdb202a32bf Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -256,6 +256,13 @@ FakeVimSettings *theFakeVimSettings()
|
|||||||
item->setCheckable(true);
|
item->setCheckable(true);
|
||||||
instance->insertItem(ConfigClipboard, item, _("clipboard"), _("cb"));
|
instance->insertItem(ConfigClipboard, item, _("clipboard"), _("cb"));
|
||||||
|
|
||||||
|
item = new SavedAction(instance);
|
||||||
|
item->setDefaultValue(true);
|
||||||
|
item->setValue(true);
|
||||||
|
item->setSettingsKey(group, _("ShowCmd")); item->setCheckable(true);
|
||||||
|
item->setCheckable(true);
|
||||||
|
instance->insertItem(ConfigShowCmd, item, _("showcmd"), _("sc"));
|
||||||
|
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,8 @@ enum FakeVimSettingsCode
|
|||||||
// other actions
|
// other actions
|
||||||
ConfigShowMarks,
|
ConfigShowMarks,
|
||||||
ConfigPassControlKey,
|
ConfigPassControlKey,
|
||||||
ConfigClipboard
|
ConfigClipboard,
|
||||||
|
ConfigShowCmd
|
||||||
};
|
};
|
||||||
|
|
||||||
class FakeVimSettings : public QObject
|
class FakeVimSettings : public QObject
|
||||||
|
|||||||
@@ -615,6 +615,94 @@ static void setClipboardData(const QString &content, RangeMode mode,
|
|||||||
clipboard->setMimeData(data, clipboardMode);
|
clipboard->setMimeData(data, clipboardMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const QMap<QString, int> &vimKeyNames()
|
||||||
|
{
|
||||||
|
static QMap<QString, int> k;
|
||||||
|
if (!k.isEmpty())
|
||||||
|
return k;
|
||||||
|
|
||||||
|
// FIXME: Should be value of mapleader.
|
||||||
|
k.insert("LEADER", Key_Backslash);
|
||||||
|
|
||||||
|
k.insert("SPACE", Key_Space);
|
||||||
|
k.insert("TAB", Key_Tab);
|
||||||
|
k.insert("NL", Key_Return);
|
||||||
|
k.insert("NEWLINE", Key_Return);
|
||||||
|
k.insert("LINEFEED", Key_Return);
|
||||||
|
k.insert("LF", Key_Return);
|
||||||
|
k.insert("CR", Key_Return);
|
||||||
|
k.insert("RETURN", Key_Return);
|
||||||
|
k.insert("ENTER", Key_Return);
|
||||||
|
k.insert("BS", Key_Backspace);
|
||||||
|
k.insert("BACKSPACE", Key_Backspace);
|
||||||
|
k.insert("ESC", Key_Escape);
|
||||||
|
k.insert("BAR", Key_Bar);
|
||||||
|
k.insert("BSLASH", Key_Backslash);
|
||||||
|
k.insert("DEL", Key_Delete);
|
||||||
|
k.insert("DELETE", Key_Delete);
|
||||||
|
k.insert("KDEL", Key_Delete);
|
||||||
|
k.insert("UP", Key_Up);
|
||||||
|
k.insert("DOWN", Key_Down);
|
||||||
|
k.insert("LEFT", Key_Left);
|
||||||
|
k.insert("RIGHT", Key_Right);
|
||||||
|
|
||||||
|
k.insert("F1", Key_F1);
|
||||||
|
k.insert("F2", Key_F2);
|
||||||
|
k.insert("F3", Key_F3);
|
||||||
|
k.insert("F4", Key_F4);
|
||||||
|
k.insert("F5", Key_F5);
|
||||||
|
k.insert("F6", Key_F6);
|
||||||
|
k.insert("F7", Key_F7);
|
||||||
|
k.insert("F8", Key_F8);
|
||||||
|
k.insert("F9", Key_F9);
|
||||||
|
k.insert("F10", Key_F10);
|
||||||
|
|
||||||
|
k.insert("F11", Key_F11);
|
||||||
|
k.insert("F12", Key_F12);
|
||||||
|
k.insert("F13", Key_F13);
|
||||||
|
k.insert("F14", Key_F14);
|
||||||
|
k.insert("F15", Key_F15);
|
||||||
|
k.insert("F16", Key_F16);
|
||||||
|
k.insert("F17", Key_F17);
|
||||||
|
k.insert("F18", Key_F18);
|
||||||
|
k.insert("F19", Key_F19);
|
||||||
|
k.insert("F20", Key_F20);
|
||||||
|
|
||||||
|
k.insert("F21", Key_F21);
|
||||||
|
k.insert("F22", Key_F22);
|
||||||
|
k.insert("F23", Key_F23);
|
||||||
|
k.insert("F24", Key_F24);
|
||||||
|
k.insert("F25", Key_F25);
|
||||||
|
k.insert("F26", Key_F26);
|
||||||
|
k.insert("F27", Key_F27);
|
||||||
|
k.insert("F28", Key_F28);
|
||||||
|
k.insert("F29", Key_F29);
|
||||||
|
k.insert("F30", Key_F30);
|
||||||
|
|
||||||
|
k.insert("F31", Key_F31);
|
||||||
|
k.insert("F32", Key_F32);
|
||||||
|
k.insert("F33", Key_F33);
|
||||||
|
k.insert("F34", Key_F34);
|
||||||
|
k.insert("F35", Key_F35);
|
||||||
|
|
||||||
|
k.insert("INSERT", Key_Insert);
|
||||||
|
k.insert("INS", Key_Insert);
|
||||||
|
k.insert("KINSERT", Key_Insert);
|
||||||
|
k.insert("HOME", Key_Home);
|
||||||
|
k.insert("END", Key_End);
|
||||||
|
k.insert("PAGEUP", Key_PageUp);
|
||||||
|
k.insert("PAGEDOWN", Key_PageDown);
|
||||||
|
|
||||||
|
k.insert("KPLUS", Key_Plus);
|
||||||
|
k.insert("KMINUS", Key_Minus);
|
||||||
|
k.insert("KDIVIDE", Key_Slash);
|
||||||
|
k.insert("KMULTIPLY", Key_Asterisk);
|
||||||
|
k.insert("KENTER", Key_Enter);
|
||||||
|
k.insert("KPOINT", Key_Period);
|
||||||
|
|
||||||
|
return k;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Range::Range()
|
Range::Range()
|
||||||
: beginPos(-1), endPos(-1), rangemode(RangeCharMode)
|
: beginPos(-1), endPos(-1), rangemode(RangeCharMode)
|
||||||
@@ -810,6 +898,17 @@ public:
|
|||||||
return m_key;
|
return m_key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString toString() const
|
||||||
|
{
|
||||||
|
bool hasCtrl = m_modifiers & int(HostOsInfo::controlModifier());
|
||||||
|
QString key = vimKeyNames().key(m_key);
|
||||||
|
if (key.isEmpty())
|
||||||
|
key = QChar(m_xkey);
|
||||||
|
else
|
||||||
|
key = '<' + key + '>';
|
||||||
|
return (hasCtrl ? QString("^") : QString()) + key;
|
||||||
|
}
|
||||||
|
|
||||||
QDebug dump(QDebug ts) const
|
QDebug dump(QDebug ts) const
|
||||||
{
|
{
|
||||||
return ts << m_key << '-' << m_modifiers << '-'
|
return ts << m_key << '-' << m_modifiers << '-'
|
||||||
@@ -849,92 +948,6 @@ private:
|
|||||||
bool m_silent;
|
bool m_silent;
|
||||||
};
|
};
|
||||||
|
|
||||||
static QMap<QString, int> vimKeyNames()
|
|
||||||
{
|
|
||||||
QMap<QString, int> k;
|
|
||||||
|
|
||||||
// FIXME: Should be value of mapleader.
|
|
||||||
k.insert("LEADER", Key_Backslash);
|
|
||||||
|
|
||||||
k.insert("SPACE", Key_Space);
|
|
||||||
k.insert("TAB", Key_Tab);
|
|
||||||
k.insert("NL", Key_Return);
|
|
||||||
k.insert("NEWLINE", Key_Return);
|
|
||||||
k.insert("LINEFEED", Key_Return);
|
|
||||||
k.insert("LF", Key_Return);
|
|
||||||
k.insert("CR", Key_Return);
|
|
||||||
k.insert("RETURN", Key_Return);
|
|
||||||
k.insert("ENTER", Key_Return);
|
|
||||||
k.insert("BS", Key_Backspace);
|
|
||||||
k.insert("BACKSPACE", Key_Backspace);
|
|
||||||
k.insert("ESC", Key_Escape);
|
|
||||||
k.insert("BAR", Key_Bar);
|
|
||||||
k.insert("BSLASH", Key_Backslash);
|
|
||||||
k.insert("DEL", Key_Delete);
|
|
||||||
k.insert("DELETE", Key_Delete);
|
|
||||||
k.insert("KDEL", Key_Delete);
|
|
||||||
k.insert("UP", Key_Up);
|
|
||||||
k.insert("DOWN", Key_Down);
|
|
||||||
k.insert("LEFT", Key_Left);
|
|
||||||
k.insert("RIGHT", Key_Right);
|
|
||||||
|
|
||||||
k.insert("F1", Key_F1);
|
|
||||||
k.insert("F2", Key_F2);
|
|
||||||
k.insert("F3", Key_F3);
|
|
||||||
k.insert("F4", Key_F4);
|
|
||||||
k.insert("F5", Key_F5);
|
|
||||||
k.insert("F6", Key_F6);
|
|
||||||
k.insert("F7", Key_F7);
|
|
||||||
k.insert("F8", Key_F8);
|
|
||||||
k.insert("F9", Key_F9);
|
|
||||||
k.insert("F10", Key_F10);
|
|
||||||
|
|
||||||
k.insert("F11", Key_F11);
|
|
||||||
k.insert("F12", Key_F12);
|
|
||||||
k.insert("F13", Key_F13);
|
|
||||||
k.insert("F14", Key_F14);
|
|
||||||
k.insert("F15", Key_F15);
|
|
||||||
k.insert("F16", Key_F16);
|
|
||||||
k.insert("F17", Key_F17);
|
|
||||||
k.insert("F18", Key_F18);
|
|
||||||
k.insert("F19", Key_F19);
|
|
||||||
k.insert("F20", Key_F20);
|
|
||||||
|
|
||||||
k.insert("F21", Key_F21);
|
|
||||||
k.insert("F22", Key_F22);
|
|
||||||
k.insert("F23", Key_F23);
|
|
||||||
k.insert("F24", Key_F24);
|
|
||||||
k.insert("F25", Key_F25);
|
|
||||||
k.insert("F26", Key_F26);
|
|
||||||
k.insert("F27", Key_F27);
|
|
||||||
k.insert("F28", Key_F28);
|
|
||||||
k.insert("F29", Key_F29);
|
|
||||||
k.insert("F30", Key_F30);
|
|
||||||
|
|
||||||
k.insert("F31", Key_F31);
|
|
||||||
k.insert("F32", Key_F32);
|
|
||||||
k.insert("F33", Key_F33);
|
|
||||||
k.insert("F34", Key_F34);
|
|
||||||
k.insert("F35", Key_F35);
|
|
||||||
|
|
||||||
k.insert("INSERT", Key_Insert);
|
|
||||||
k.insert("INS", Key_Insert);
|
|
||||||
k.insert("KINSERT", Key_Insert);
|
|
||||||
k.insert("HOME", Key_Home);
|
|
||||||
k.insert("END", Key_End);
|
|
||||||
k.insert("PAGEUP", Key_PageUp);
|
|
||||||
k.insert("PAGEDOWN", Key_PageDown);
|
|
||||||
|
|
||||||
k.insert("KPLUS", Key_Plus);
|
|
||||||
k.insert("KMINUS", Key_Minus);
|
|
||||||
k.insert("KDIVIDE", Key_Slash);
|
|
||||||
k.insert("KMULTIPLY", Key_Asterisk);
|
|
||||||
k.insert("KENTER", Key_Enter);
|
|
||||||
k.insert("KPOINT", Key_Period);
|
|
||||||
|
|
||||||
return k;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Input parseVimKeyName(const QString &keyName)
|
static Input parseVimKeyName(const QString &keyName)
|
||||||
{
|
{
|
||||||
if (keyName.length() == 1)
|
if (keyName.length() == 1)
|
||||||
@@ -966,9 +979,8 @@ static Input parseVimKeyName(const QString &keyName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// find key name
|
// find key name
|
||||||
static const QMap<QString, int> k = vimKeyNames();
|
QMap<QString, int>::ConstIterator it = vimKeyNames().constFind(key.toUpper());
|
||||||
QMap<QString, int>::ConstIterator it = k.constFind(key.toUpper());
|
if (it != vimKeyNames().end())
|
||||||
if (it != k.end())
|
|
||||||
return Input(*it, mods);
|
return Input(*it, mods);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1751,6 +1763,7 @@ public:
|
|||||||
// Current mini buffer message.
|
// Current mini buffer message.
|
||||||
QString currentMessage;
|
QString currentMessage;
|
||||||
MessageLevel currentMessageLevel;
|
MessageLevel currentMessageLevel;
|
||||||
|
QString currentCommand;
|
||||||
|
|
||||||
// Search state.
|
// Search state.
|
||||||
QString lastSearch;
|
QString lastSearch;
|
||||||
@@ -1828,8 +1841,7 @@ bool FakeVimHandler::Private::wantsOverride(QKeyEvent *ev)
|
|||||||
if (isNoVisualMode()
|
if (isNoVisualMode()
|
||||||
&& m_mode == CommandMode
|
&& m_mode == CommandMode
|
||||||
&& m_submode == NoSubMode
|
&& m_submode == NoSubMode
|
||||||
&& m_opcount.isEmpty()
|
&& g.currentCommand.isEmpty())
|
||||||
&& m_mvcount.isEmpty())
|
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -2141,6 +2153,8 @@ EventResult FakeVimHandler::Private::handleKey(const Input &input)
|
|||||||
// if the mapped input can be completed complete.
|
// if the mapped input can be completed complete.
|
||||||
if (hasInput && g.currentMap.walk(input)) {
|
if (hasInput && g.currentMap.walk(input)) {
|
||||||
if (g.currentMap.canExtend()) {
|
if (g.currentMap.canExtend()) {
|
||||||
|
g.currentCommand.append(input.toString());
|
||||||
|
updateMiniBuffer();
|
||||||
g.inputTimer = startTimer(1000);
|
g.inputTimer = startTimer(1000);
|
||||||
return EventHandled;
|
return EventHandled;
|
||||||
} else {
|
} else {
|
||||||
@@ -2153,6 +2167,8 @@ EventResult FakeVimHandler::Private::handleKey(const Input &input)
|
|||||||
g.currentMap.reset();
|
g.currentMap.reset();
|
||||||
handleMapped = false;
|
handleMapped = false;
|
||||||
}
|
}
|
||||||
|
g.currentCommand.clear();
|
||||||
|
updateMiniBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
EventResult r = EventUnhandled;
|
EventResult r = EventUnhandled;
|
||||||
@@ -2174,6 +2190,8 @@ EventResult FakeVimHandler::Private::handleKey(const Input &input)
|
|||||||
|
|
||||||
// handle user mapping
|
// handle user mapping
|
||||||
if (g.currentMap.canExtend()) {
|
if (g.currentMap.canExtend()) {
|
||||||
|
g.currentCommand.append(in.toString());
|
||||||
|
updateMiniBuffer();
|
||||||
// wait for user to press any key or trigger complete mapping after interval
|
// wait for user to press any key or trigger complete mapping after interval
|
||||||
g.inputTimer = startTimer(1000);
|
g.inputTimer = startTimer(1000);
|
||||||
return EventHandled;
|
return EventHandled;
|
||||||
@@ -2496,7 +2514,6 @@ void FakeVimHandler::Private::finishMovement(const QString &dotCommandMovement)
|
|||||||
int endLine = lineForPosition(position());
|
int endLine = lineForPosition(position());
|
||||||
setPosition(qMin(anchor(), position()));
|
setPosition(qMin(anchor(), position()));
|
||||||
enterExMode(QString(".,+%1!").arg(qAbs(endLine - beginLine)));
|
enterExMode(QString(".,+%1!").arg(qAbs(endLine - beginLine)));
|
||||||
updateMiniBuffer();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2600,6 +2617,7 @@ void FakeVimHandler::Private::resetCommandMode()
|
|||||||
m_rangemode = RangeCharMode;
|
m_rangemode = RangeCharMode;
|
||||||
if (isNoVisualMode())
|
if (isNoVisualMode())
|
||||||
setAnchor();
|
setAnchor();
|
||||||
|
g.currentCommand.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FakeVimHandler::Private::updateSelection()
|
void FakeVimHandler::Private::updateSelection()
|
||||||
@@ -2658,6 +2676,9 @@ void FakeVimHandler::Private::updateMiniBuffer()
|
|||||||
} else if (g.mapStates.size() > 1 && !g.mapStates.last().silent) {
|
} else if (g.mapStates.size() > 1 && !g.mapStates.last().silent) {
|
||||||
// Do not reset previous message when after running a mapped command.
|
// Do not reset previous message when after running a mapped command.
|
||||||
return;
|
return;
|
||||||
|
} else if (m_mode == CommandMode && !g.currentCommand.isEmpty() && hasConfig(ConfigShowCmd)) {
|
||||||
|
msg = g.currentCommand;
|
||||||
|
messageLevel = MessageShowCmd;
|
||||||
} else if (m_mode == CommandMode && isVisualMode()) {
|
} else if (m_mode == CommandMode && isVisualMode()) {
|
||||||
if (isVisualCharMode()) {
|
if (isVisualCharMode()) {
|
||||||
msg = "VISUAL";
|
msg = "VISUAL";
|
||||||
@@ -2696,14 +2717,12 @@ void FakeVimHandler::Private::showMessage(MessageLevel level, const QString &msg
|
|||||||
//qDebug() << "MSG: " << msg;
|
//qDebug() << "MSG: " << msg;
|
||||||
g.currentMessage = msg;
|
g.currentMessage = msg;
|
||||||
g.currentMessageLevel = level;
|
g.currentMessageLevel = level;
|
||||||
updateMiniBuffer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FakeVimHandler::Private::notImplementedYet()
|
void FakeVimHandler::Private::notImplementedYet()
|
||||||
{
|
{
|
||||||
qDebug() << "Not implemented in FakeVim";
|
qDebug() << "Not implemented in FakeVim";
|
||||||
showMessage(MessageError, FakeVimHandler::tr("Not implemented in FakeVim"));
|
showMessage(MessageError, FakeVimHandler::tr("Not implemented in FakeVim"));
|
||||||
updateMiniBuffer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FakeVimHandler::Private::passShortcuts(bool enable)
|
void FakeVimHandler::Private::passShortcuts(bool enable)
|
||||||
@@ -2868,7 +2887,6 @@ bool FakeVimHandler::Private::handleMovement(const Input &input)
|
|||||||
m_searchFromScreenLine = firstVisibleLine();
|
m_searchFromScreenLine = firstVisibleLine();
|
||||||
m_searchCursor = QTextCursor();
|
m_searchCursor = QTextCursor();
|
||||||
g.searchBuffer.clear();
|
g.searchBuffer.clear();
|
||||||
updateMiniBuffer();
|
|
||||||
}
|
}
|
||||||
} else if (input.is('`')) {
|
} else if (input.is('`')) {
|
||||||
m_subsubmode = BackTickSubSubMode;
|
m_subsubmode = BackTickSubSubMode;
|
||||||
@@ -3156,7 +3174,7 @@ EventResult FakeVimHandler::Private::handleCommandMode(const Input &input)
|
|||||||
handled = handleChangeCaseSubMode(input);
|
handled = handleChangeCaseSubMode(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear state if necessary.
|
// Clear state and display incomplete command if necessary.
|
||||||
if (handled) {
|
if (handled) {
|
||||||
bool noMode =
|
bool noMode =
|
||||||
(m_mode == CommandMode && m_submode == NoSubMode && m_subsubmode == NoSubSubMode);
|
(m_mode == CommandMode && m_submode == NoSubMode && m_subsubmode == NoSubSubMode);
|
||||||
@@ -3172,6 +3190,11 @@ EventResult FakeVimHandler::Private::handleCommandMode(const Input &input)
|
|||||||
m_mvcount.clear();
|
m_mvcount.clear();
|
||||||
m_opcount.clear();
|
m_opcount.clear();
|
||||||
}
|
}
|
||||||
|
// Show or clear current command on minibuffer (showcmd).
|
||||||
|
if (input.isEscape() || m_mode != CommandMode || clearCount)
|
||||||
|
g.currentCommand.clear();
|
||||||
|
else
|
||||||
|
g.currentCommand.append(input.toString());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
resetCommandMode();
|
resetCommandMode();
|
||||||
@@ -3185,6 +3208,8 @@ EventResult FakeVimHandler::Private::handleCommandMode(const Input &input)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateMiniBuffer();
|
||||||
|
|
||||||
m_positionPastEnd = (m_visualTargetColumn == -1) && isVisualMode();
|
m_positionPastEnd = (m_visualTargetColumn == -1) && isVisualMode();
|
||||||
|
|
||||||
return handled ? EventHandled : EventCancelled;
|
return handled ? EventHandled : EventCancelled;
|
||||||
@@ -3195,7 +3220,6 @@ bool FakeVimHandler::Private::handleEscape()
|
|||||||
if (isVisualMode())
|
if (isVisualMode())
|
||||||
leaveVisualMode();
|
leaveVisualMode();
|
||||||
resetCommandMode();
|
resetCommandMode();
|
||||||
updateMiniBuffer();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3207,12 +3231,10 @@ bool FakeVimHandler::Private::handleNoSubMode(const Input &input)
|
|||||||
handleExCommand(m_gflag ? "%s//~/&" : "s");
|
handleExCommand(m_gflag ? "%s//~/&" : "s");
|
||||||
} else if (input.is(':')) {
|
} else if (input.is(':')) {
|
||||||
enterExMode();
|
enterExMode();
|
||||||
updateMiniBuffer();
|
|
||||||
} else if (input.is('!') && isNoVisualMode()) {
|
} else if (input.is('!') && isNoVisualMode()) {
|
||||||
m_submode = FilterSubMode;
|
m_submode = FilterSubMode;
|
||||||
} else if (input.is('!') && isVisualMode()) {
|
} else if (input.is('!') && isVisualMode()) {
|
||||||
enterExMode(QString("!"));
|
enterExMode(QString("!"));
|
||||||
updateMiniBuffer();
|
|
||||||
} else if (input.is('"')) {
|
} else if (input.is('"')) {
|
||||||
m_submode = RegisterSubMode;
|
m_submode = RegisterSubMode;
|
||||||
} else if (input.is(',')) {
|
} else if (input.is(',')) {
|
||||||
@@ -3257,7 +3279,6 @@ bool FakeVimHandler::Private::handleNoSubMode(const Input &input)
|
|||||||
if (!atEndOfLine())
|
if (!atEndOfLine())
|
||||||
moveRight();
|
moveRight();
|
||||||
setUndoPosition();
|
setUndoPosition();
|
||||||
updateMiniBuffer();
|
|
||||||
} else if (input.is('A')) {
|
} else if (input.is('A')) {
|
||||||
breakEditBlock();
|
breakEditBlock();
|
||||||
moveBehindEndOfLine();
|
moveBehindEndOfLine();
|
||||||
@@ -3266,7 +3287,6 @@ bool FakeVimHandler::Private::handleNoSubMode(const Input &input)
|
|||||||
enterInsertMode();
|
enterInsertMode();
|
||||||
setDotCommand("%1A", count());
|
setDotCommand("%1A", count());
|
||||||
m_lastInsertion.clear();
|
m_lastInsertion.clear();
|
||||||
updateMiniBuffer();
|
|
||||||
} else if (input.isControl('a')) {
|
} else if (input.isControl('a')) {
|
||||||
changeNumberTextObject(count());
|
changeNumberTextObject(count());
|
||||||
setDotCommand("%1<c-a>", count());
|
setDotCommand("%1<c-a>", count());
|
||||||
@@ -3360,7 +3380,6 @@ bool FakeVimHandler::Private::handleNoSubMode(const Input &input)
|
|||||||
setDotCommand("%1i", count());
|
setDotCommand("%1i", count());
|
||||||
breakEditBlock();
|
breakEditBlock();
|
||||||
enterInsertMode();
|
enterInsertMode();
|
||||||
updateMiniBuffer();
|
|
||||||
if (atEndOfLine())
|
if (atEndOfLine())
|
||||||
moveLeft();
|
moveLeft();
|
||||||
} else if (input.is('I')) {
|
} else if (input.is('I')) {
|
||||||
@@ -3430,7 +3449,6 @@ bool FakeVimHandler::Private::handleNoSubMode(const Input &input)
|
|||||||
setUndoPosition();
|
setUndoPosition();
|
||||||
breakEditBlock();
|
breakEditBlock();
|
||||||
enterReplaceMode();
|
enterReplaceMode();
|
||||||
updateMiniBuffer();
|
|
||||||
} else if (input.isControl('r')) {
|
} else if (input.isControl('r')) {
|
||||||
int repeat = count();
|
int repeat = count();
|
||||||
while (--repeat >= 0)
|
while (--repeat >= 0)
|
||||||
|
|||||||
@@ -82,7 +82,8 @@ enum MessageLevel
|
|||||||
MessageCommand, // show last Ex command or search
|
MessageCommand, // show last Ex command or search
|
||||||
MessageInfo, // result of a command
|
MessageInfo, // result of a command
|
||||||
MessageWarning, // warning
|
MessageWarning, // warning
|
||||||
MessageError // error
|
MessageError, // error
|
||||||
|
MessageShowCmd // partial command
|
||||||
};
|
};
|
||||||
|
|
||||||
class FakeVimHandler : public QObject
|
class FakeVimHandler : public QObject
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>513</width>
|
<width>513</width>
|
||||||
<height>449</height>
|
<height>461</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
@@ -31,69 +31,6 @@
|
|||||||
<string>Vim Behavior</string>
|
<string>Vim Behavior</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0" colspan="2">
|
|
||||||
<widget class="QCheckBox" name="checkBoxAutoIndent">
|
|
||||||
<property name="text">
|
|
||||||
<string>Automatic indentation</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<widget class="QCheckBox" name="checkBoxStartOfLine">
|
|
||||||
<property name="text">
|
|
||||||
<string>Start of line</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0" colspan="2">
|
|
||||||
<widget class="QCheckBox" name="checkBoxSmartIndent">
|
|
||||||
<property name="text">
|
|
||||||
<string>Smart indentation</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QCheckBox" name="checkBoxUseCoreSearch">
|
|
||||||
<property name="text">
|
|
||||||
<string>Use search dialog</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="2">
|
|
||||||
<widget class="QCheckBox" name="checkBoxSmartCase">
|
|
||||||
<property name="text">
|
|
||||||
<string>Use smartcase</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="2">
|
|
||||||
<widget class="QCheckBox" name="checkBoxWrapScan">
|
|
||||||
<property name="text">
|
|
||||||
<string>Use wrapscan</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0" colspan="2">
|
|
||||||
<widget class="QCheckBox" name="checkBoxExpandTab">
|
|
||||||
<property name="text">
|
|
||||||
<string>Expand tabulators</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="2">
|
|
||||||
<widget class="QCheckBox" name="checkBoxShowMarks">
|
|
||||||
<property name="text">
|
|
||||||
<string>Show position of text marks</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0" colspan="2">
|
|
||||||
<widget class="QCheckBox" name="checkBoxSmartTab">
|
|
||||||
<property name="text">
|
|
||||||
<string>Smart tabulators</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="2">
|
<item row="5" column="2">
|
||||||
<widget class="QCheckBox" name="checkBoxPassControlKey">
|
<widget class="QCheckBox" name="checkBoxPassControlKey">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
@@ -118,51 +55,28 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0">
|
<item row="0" column="2">
|
||||||
<widget class="QLabel" name="labelShiftWidth">
|
<widget class="QCheckBox" name="checkBoxStartOfLine">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Shift width:</string>
|
<string>Start of line</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="1" colspan="2">
|
<item row="1" column="0" colspan="2">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<widget class="QCheckBox" name="checkBoxSmartIndent">
|
||||||
<item>
|
|
||||||
<widget class="QSpinBox" name="spinBoxShiftWidth">
|
|
||||||
<property name="minimum">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>80</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="7" column="0">
|
|
||||||
<widget class="QLabel" name="labelTabulator">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Vim tabstop option</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Tabulator size:</string>
|
<string>Smart indentation</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="1" colspan="2">
|
<item row="0" column="0" colspan="2">
|
||||||
|
<widget class="QCheckBox" name="checkBoxAutoIndent">
|
||||||
|
<property name="text">
|
||||||
|
<string>Automatic indentation</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="1" colspan="2">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSpinBox" name="spinBoxTabStop">
|
<widget class="QSpinBox" name="spinBoxTabStop">
|
||||||
@@ -189,43 +103,34 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="0">
|
<item row="9" column="0">
|
||||||
<widget class="QLabel" name="labelBackspace">
|
<widget class="QLabel" name="labelBackspace">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Backspace:</string>
|
<string>Backspace:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="1" colspan="2">
|
<item row="9" column="1" colspan="2">
|
||||||
<widget class="QLineEdit" name="lineEditBackspace"/>
|
<widget class="QLineEdit" name="lineEditBackspace"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="0">
|
<item row="10" column="0">
|
||||||
<widget class="QLabel" name="labelIsKeyword">
|
<widget class="QLabel" name="labelIsKeyword">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Keyword characters:</string>
|
<string>Keyword characters:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="1" colspan="2">
|
<item row="8" column="0">
|
||||||
<widget class="QLineEdit" name="lineEditIsKeyword"/>
|
<widget class="QLabel" name="labelTabulator">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Vim tabstop option</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Tabulator size:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="10" column="0">
|
<item row="12" column="0" colspan="3">
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>17</width>
|
|
||||||
<height>10</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="11" column="0" colspan="3">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButtonCopyTextEditorSettings">
|
<widget class="QPushButton" name="pushButtonCopyTextEditorSettings">
|
||||||
@@ -263,6 +168,108 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="7" column="0">
|
||||||
|
<widget class="QLabel" name="labelShiftWidth">
|
||||||
|
<property name="text">
|
||||||
|
<string>Shift width:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0" colspan="2">
|
||||||
|
<widget class="QCheckBox" name="checkBoxExpandTab">
|
||||||
|
<property name="text">
|
||||||
|
<string>Expand tabulators</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="2">
|
||||||
|
<widget class="QCheckBox" name="checkBoxShowMarks">
|
||||||
|
<property name="text">
|
||||||
|
<string>Show position of text marks</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0" colspan="2">
|
||||||
|
<widget class="QCheckBox" name="checkBoxSmartTab">
|
||||||
|
<property name="text">
|
||||||
|
<string>Smart tabulators</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="10" column="1" colspan="2">
|
||||||
|
<widget class="QLineEdit" name="lineEditIsKeyword"/>
|
||||||
|
</item>
|
||||||
|
<item row="11" column="0">
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>17</width>
|
||||||
|
<height>10</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QCheckBox" name="checkBoxUseCoreSearch">
|
||||||
|
<property name="text">
|
||||||
|
<string>Use search dialog</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<widget class="QCheckBox" name="checkBoxSmartCase">
|
||||||
|
<property name="text">
|
||||||
|
<string>Use smartcase</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="2">
|
||||||
|
<widget class="QCheckBox" name="checkBoxWrapScan">
|
||||||
|
<property name="text">
|
||||||
|
<string>Use wrapscan</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="1" colspan="2">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="spinBoxShiftWidth">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>80</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="0">
|
||||||
|
<widget class="QCheckBox" name="checkBoxShowCmd">
|
||||||
|
<property name="text">
|
||||||
|
<string>Show partial command</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -281,6 +288,30 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<tabstops>
|
||||||
|
<tabstop>checkBoxUseFakeVim</tabstop>
|
||||||
|
<tabstop>checkBoxReadVimRc</tabstop>
|
||||||
|
<tabstop>checkBoxAutoIndent</tabstop>
|
||||||
|
<tabstop>checkBoxSmartIndent</tabstop>
|
||||||
|
<tabstop>checkBoxExpandTab</tabstop>
|
||||||
|
<tabstop>checkBoxSmartTab</tabstop>
|
||||||
|
<tabstop>checkBoxHlSearch</tabstop>
|
||||||
|
<tabstop>checkBoxIncSearch</tabstop>
|
||||||
|
<tabstop>checkBoxShowCmd</tabstop>
|
||||||
|
<tabstop>checkBoxStartOfLine</tabstop>
|
||||||
|
<tabstop>checkBoxUseCoreSearch</tabstop>
|
||||||
|
<tabstop>checkBoxSmartCase</tabstop>
|
||||||
|
<tabstop>checkBoxWrapScan</tabstop>
|
||||||
|
<tabstop>checkBoxShowMarks</tabstop>
|
||||||
|
<tabstop>checkBoxPassControlKey</tabstop>
|
||||||
|
<tabstop>spinBoxShiftWidth</tabstop>
|
||||||
|
<tabstop>spinBoxTabStop</tabstop>
|
||||||
|
<tabstop>lineEditBackspace</tabstop>
|
||||||
|
<tabstop>lineEditIsKeyword</tabstop>
|
||||||
|
<tabstop>pushButtonCopyTextEditorSettings</tabstop>
|
||||||
|
<tabstop>pushButtonSetQtStyle</tabstop>
|
||||||
|
<tabstop>pushButtonSetPlainStyle</tabstop>
|
||||||
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ public:
|
|||||||
|
|
||||||
setCurrentWidget(m_edit);
|
setCurrentWidget(m_edit);
|
||||||
m_edit->setFocus();
|
m_edit->setFocus();
|
||||||
} else if (contents.isEmpty()) {
|
} else if (contents.isEmpty() && messageLevel != MessageShowCmd) {
|
||||||
hide();
|
hide();
|
||||||
} else {
|
} else {
|
||||||
show();
|
show();
|
||||||
@@ -152,6 +152,9 @@ public:
|
|||||||
} else if (messageLevel == MessageWarning) {
|
} else if (messageLevel == MessageWarning) {
|
||||||
css = QString("border:1px solid rgba(255,255,255,120);"
|
css = QString("border:1px solid rgba(255,255,255,120);"
|
||||||
"background-color:rgba(255,255,0,20);");
|
"background-color:rgba(255,255,0,20);");
|
||||||
|
} else if (messageLevel == MessageShowCmd) {
|
||||||
|
css = QString("border:1px solid rgba(255,255,255,120);"
|
||||||
|
"background-color:rgba(100,255,100,30);");
|
||||||
}
|
}
|
||||||
m_label->setStyleSheet(QString(
|
m_label->setStyleSheet(QString(
|
||||||
"*{border-radius:2px;padding-left:4px;padding-right:4px;%1}").arg(css));
|
"*{border-radius:2px;padding-left:4px;padding-right:4px;%1}").arg(css));
|
||||||
@@ -298,6 +301,9 @@ QWidget *FakeVimOptionPage::createPage(QWidget *parent)
|
|||||||
m_group.insert(theFakeVimSetting(ConfigWrapScan),
|
m_group.insert(theFakeVimSetting(ConfigWrapScan),
|
||||||
m_ui.checkBoxWrapScan);
|
m_ui.checkBoxWrapScan);
|
||||||
|
|
||||||
|
m_group.insert(theFakeVimSetting(ConfigShowCmd),
|
||||||
|
m_ui.checkBoxShowCmd);
|
||||||
|
|
||||||
connect(m_ui.pushButtonCopyTextEditorSettings, SIGNAL(clicked()),
|
connect(m_ui.pushButtonCopyTextEditorSettings, SIGNAL(clicked()),
|
||||||
SLOT(copyTextEditorSettings()));
|
SLOT(copyTextEditorSettings()));
|
||||||
connect(m_ui.pushButtonSetQtStyle, SIGNAL(clicked()),
|
connect(m_ui.pushButtonSetQtStyle, SIGNAL(clicked()),
|
||||||
|
|||||||
Reference in New Issue
Block a user