diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index ec0d9a4b517e435418d22569db8ba7044036a57c..b7239ae1b5f01898b3ce07c307d5cb7713d2bd8c 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -89,6 +89,13 @@ using namespace FakeVim::Internal; using namespace FakeVim::Constants; + +/////////////////////////////////////////////////////////////////////// +// +// FakeVimHandler +// +/////////////////////////////////////////////////////////////////////// + #define StartOfLine QTextCursor::StartOfLine #define EndOfLine QTextCursor::EndOfLine #define MoveAnchor QTextCursor::MoveAnchor @@ -99,12 +106,6 @@ using namespace FakeVim::Constants; #define Left QTextCursor::Left #define EndOfDocument QTextCursor::End -/////////////////////////////////////////////////////////////////////// -// -// FakeVimHandler -// -/////////////////////////////////////////////////////////////////////// - #define EDITOR(s) (m_textedit ? m_textedit->s : m_plaintextedit->s) const int ParagraphSeparator = 0x00002029; @@ -427,7 +428,7 @@ bool FakeVimHandler::Private::wantsOverride(QKeyEvent *ev) KEY_DEBUG("SHORTCUT OVERRIDE" << key << " PASSING: " << m_passing); if (key == Key_Escape) { - // Not sure this feels good. People of ten hit Esc several times + // Not sure this feels good. People often hit Esc several times if (m_visualMode == NoVisualMode && m_mode == CommandMode) return false; return true; @@ -1846,6 +1847,7 @@ void FakeVimHandler::Private::indentRegion(QChar typedChar) qSwap(beginLine, endLine); int amount = 0; emit q->indentRegion(&amount, beginLine, endLine, typedChar); + m_dotCommand = QString("%1==").arg(endLine - beginLine + 1); } void FakeVimHandler::Private::shiftRegionRight(int repeat) @@ -1856,18 +1858,21 @@ void FakeVimHandler::Private::shiftRegionRight(int repeat) qSwap(beginLine, endLine); int len = m_config[ConfigShiftWidth].toInt() * repeat; QString indent(len, ' '); + int firstPos = firstPositionInLine(beginLine); recordBeginGroup(); - recordPosition(); + //setPosition(firstPos); + //recordPosition(); for (int line = beginLine; line <= endLine; ++line) { setPosition(firstPositionInLine(line)); recordInsertText(indent); } - setPosition(firstPositionInLine(beginLine)); + setPosition(firstPos); moveToFirstNonBlankOnLine(); recordEndGroup(); + m_dotCommand = QString("%1>>").arg(endLine - beginLine + 1); } void FakeVimHandler::Private::shiftRegionLeft(int repeat) @@ -1878,9 +1883,11 @@ void FakeVimHandler::Private::shiftRegionLeft(int repeat) qSwap(beginLine, endLine); int shift = m_config[ConfigShiftWidth].toInt() * repeat; int tab = m_config[ConfigTabStop].toInt(); + int firstPos = firstPositionInLine(beginLine); recordBeginGroup(); - recordPosition(); + //setPosition(firstPos); + //recordPosition(); for (int line = beginLine; line <= endLine; ++line) { int pos = firstPositionInLine(line); @@ -1902,9 +1909,10 @@ void FakeVimHandler::Private::shiftRegionLeft(int repeat) setPosition(pos); } - setPosition(firstPositionInLine(beginLine)); + setPosition(firstPos); moveToFirstNonBlankOnLine(); recordEndGroup(); + m_dotCommand = QString("%1<<").arg(endLine - beginLine + 1); } void FakeVimHandler::Private::moveToDesiredColumn()