forked from qt-creator/qt-creator
fakevim: common implementation of 'G' and 'gg'
Merge-request: 96 Reviewed-by: hjk <qtc-committer@nokia.com>
This commit is contained in:
@@ -1381,21 +1381,25 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
|
|||||||
m_subsubmode = FtSubSubMode;
|
m_subsubmode = FtSubSubMode;
|
||||||
m_movetype = MoveExclusive;
|
m_movetype = MoveExclusive;
|
||||||
m_subsubdata = key;
|
m_subsubdata = key;
|
||||||
} else if (key == 'g') {
|
} else if (key == 'g' && !m_gflag) {
|
||||||
if (m_gflag) {
|
m_gflag = true;
|
||||||
|
} else if (key == 'g' || key == 'G') {
|
||||||
|
QString dotCommand = key + m_mvcount;
|
||||||
|
if (key == 'g')
|
||||||
m_gflag = false;
|
m_gflag = false;
|
||||||
int n = m_mvcount.isEmpty() ? 1 : count();
|
int n = (key == 'g') ? 1 : linesInDocument();
|
||||||
|
n = m_mvcount.isEmpty() ? n : count();
|
||||||
|
if (m_submode == NoSubMode || m_submode == ZSubMode
|
||||||
|
|| m_submode == CapitalZSubMode || m_submode == RegisterSubMode) {
|
||||||
m_tc.setPosition(firstPositionInLine(n), KeepAnchor);
|
m_tc.setPosition(firstPositionInLine(n), KeepAnchor);
|
||||||
handleStartOfLine();
|
handleStartOfLine();
|
||||||
finishMovement();
|
|
||||||
} else {
|
} else {
|
||||||
m_gflag = true;
|
m_movetype = MoveLineWise;
|
||||||
|
m_rangemode = RangeLineMode;
|
||||||
|
setAnchor();
|
||||||
|
m_tc.setPosition(firstPositionInLine(n), KeepAnchor);
|
||||||
}
|
}
|
||||||
} else if (key == 'G') {
|
finishMovement(dotCommand);
|
||||||
int n = m_mvcount.isEmpty() ? linesInDocument() : count();
|
|
||||||
m_tc.setPosition(firstPositionInLine(n), KeepAnchor);
|
|
||||||
handleStartOfLine();
|
|
||||||
finishMovement();
|
|
||||||
} else if (key == 'h' || key == Key_Left
|
} else if (key == 'h' || key == Key_Left
|
||||||
|| key == Key_Backspace || key == control('h')) {
|
|| key == Key_Backspace || key == control('h')) {
|
||||||
int n = qMin(count(), leftDist());
|
int n = qMin(count(), leftDist());
|
||||||
|
Reference in New Issue
Block a user