forked from qt-creator/qt-creator
FakeVim: Remove superfluous cursor shape changes
Change-Id: I6996d82a0a3b0e0a7bb5ddc9732297bebd368a2d Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -2323,23 +2323,22 @@ void FakeVimHandler::Private::focus()
|
|||||||
enterFakeVim();
|
enterFakeVim();
|
||||||
|
|
||||||
stopIncrementalFind();
|
stopIncrementalFind();
|
||||||
if (!isInsertMode()) {
|
if (isCommandLineMode()) {
|
||||||
if (g.subsubmode == SearchSubSubMode || g.submode != NoSubMode || g.mode == ExMode) {
|
if (g.subsubmode == SearchSubSubMode) {
|
||||||
if (g.subsubmode == SearchSubSubMode) {
|
setPosition(m_searchStartPosition);
|
||||||
setPosition(m_searchStartPosition);
|
scrollToLine(m_searchFromScreenLine);
|
||||||
scrollToLine(m_searchFromScreenLine);
|
} else {
|
||||||
} else {
|
leaveVisualMode();
|
||||||
leaveVisualMode();
|
setPosition(qMin(position(), anchor()));
|
||||||
setPosition(qMin(position(), anchor()));
|
|
||||||
}
|
|
||||||
setTargetColumn();
|
|
||||||
setAnchor();
|
|
||||||
commitCursor();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
leaveCurrentMode();
|
leaveCurrentMode();
|
||||||
|
setTargetColumn();
|
||||||
|
setAnchor();
|
||||||
|
commitCursor();
|
||||||
|
} else {
|
||||||
|
clearCurrentMode();
|
||||||
|
updateCursorShape();
|
||||||
}
|
}
|
||||||
updateCursorShape();
|
|
||||||
updateHighlights();
|
updateHighlights();
|
||||||
|
|
||||||
leaveFakeVim(false);
|
leaveFakeVim(false);
|
||||||
@@ -2379,7 +2378,6 @@ void FakeVimHandler::Private::leaveFakeVim(bool needUpdate)
|
|||||||
updateScrollOffset();
|
updateScrollOffset();
|
||||||
|
|
||||||
commitCursor();
|
commitCursor();
|
||||||
updateCursorShape();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateMiniBuffer();
|
updateMiniBuffer();
|
||||||
@@ -3084,6 +3082,8 @@ void FakeVimHandler::Private::commitCursor()
|
|||||||
tc.clearSelection();
|
tc.clearSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateCursorShape();
|
||||||
|
|
||||||
if (isVisualBlockMode()) {
|
if (isVisualBlockMode()) {
|
||||||
emit q->requestSetBlockSelection(tc);
|
emit q->requestSetBlockSelection(tc);
|
||||||
} else {
|
} else {
|
||||||
@@ -4521,9 +4521,9 @@ bool FakeVimHandler::Private::handleWindowSubMode(const Input &input)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
leaveVisualMode();
|
leaveVisualMode();
|
||||||
|
leaveCurrentMode();
|
||||||
emit q->windowCommandRequested(input.toString(), count());
|
emit q->windowCommandRequested(input.toString(), count());
|
||||||
|
|
||||||
g.submode = NoSubMode;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6383,7 +6383,7 @@ int FakeVimHandler::Private::charClass(QChar c, bool simple) const
|
|||||||
void FakeVimHandler::Private::miniBufferTextEdited(const QString &text, int cursorPos,
|
void FakeVimHandler::Private::miniBufferTextEdited(const QString &text, int cursorPos,
|
||||||
int anchorPos)
|
int anchorPos)
|
||||||
{
|
{
|
||||||
if (g.subsubmode != SearchSubSubMode && g.mode != ExMode) {
|
if (!isCommandLineMode()) {
|
||||||
editor()->setFocus();
|
editor()->setFocus();
|
||||||
} else if (text.isEmpty()) {
|
} else if (text.isEmpty()) {
|
||||||
// editing cancelled
|
// editing cancelled
|
||||||
@@ -6392,7 +6392,6 @@ void FakeVimHandler::Private::miniBufferTextEdited(const QString &text, int curs
|
|||||||
leaveFakeVim();
|
leaveFakeVim();
|
||||||
|
|
||||||
editor()->setFocus();
|
editor()->setFocus();
|
||||||
updateCursorShape();
|
|
||||||
} else {
|
} else {
|
||||||
CommandBuffer &cmdBuf = (g.mode == ExMode) ? g.commandBuffer : g.searchBuffer;
|
CommandBuffer &cmdBuf = (g.mode == ExMode) ? g.commandBuffer : g.searchBuffer;
|
||||||
int pos = qMax(1, cursorPos);
|
int pos = qMax(1, cursorPos);
|
||||||
@@ -7243,8 +7242,6 @@ bool FakeVimHandler::Private::passEventToEditor(QEvent &event, QTextCursor &tc)
|
|||||||
if (!m_textedit && !m_plaintextedit)
|
if (!m_textedit && !m_plaintextedit)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
updateCursorShape();
|
|
||||||
|
|
||||||
if (accepted)
|
if (accepted)
|
||||||
tc = EDITOR(textCursor());
|
tc = EDITOR(textCursor());
|
||||||
|
|
||||||
@@ -7676,10 +7673,7 @@ void FakeVimHandler::Private::redo()
|
|||||||
|
|
||||||
void FakeVimHandler::Private::updateCursorShape()
|
void FakeVimHandler::Private::updateCursorShape()
|
||||||
{
|
{
|
||||||
bool thinCursor = g.mode == ExMode
|
bool thinCursor = g.mode == InsertMode || isVisualLineMode() || isVisualBlockMode();
|
||||||
|| g.subsubmode == SearchSubSubMode
|
|
||||||
|| g.mode == InsertMode
|
|
||||||
|| (isVisualMode() && !isVisualCharMode());
|
|
||||||
EDITOR(setOverwriteMode(!thinCursor));
|
EDITOR(setOverwriteMode(!thinCursor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user