forked from qt-creator/qt-creator
Fixes: fakevim: more 'z' commands
This commit is contained in:
@@ -688,17 +688,27 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
|
|||||||
indentRegion(m_tc.block(), m_tc.block().next());
|
indentRegion(m_tc.block(), m_tc.block().next());
|
||||||
finishMovement();
|
finishMovement();
|
||||||
} else if (m_submode == ZSubMode) {
|
} else if (m_submode == ZSubMode) {
|
||||||
if (key == Key_Return) {
|
//qDebug() << "Z_MODE " << cursorLineInDocument() << linesOnScreen();
|
||||||
// cursor line to top of window, cursor on first non-blank
|
if (key == Key_Return || key == 't') { // cursor line to top of window
|
||||||
|
if (!m_mvcount.isEmpty())
|
||||||
|
m_tc.setPosition(positionForLine(count()));
|
||||||
scrollToLineInDocument(cursorLineInDocument());
|
scrollToLineInDocument(cursorLineInDocument());
|
||||||
|
if (key == Key_Return)
|
||||||
moveToFirstNonBlankOnLine();
|
moveToFirstNonBlankOnLine();
|
||||||
finishMovement();
|
finishMovement();
|
||||||
} else if (key == '.') { // center cursor line
|
} else if (key == '.' || key == 'z') { // cursor line to center of window
|
||||||
|
if (!m_mvcount.isEmpty())
|
||||||
|
m_tc.setPosition(positionForLine(count()));
|
||||||
scrollToLineInDocument(cursorLineInDocument() - linesOnScreen() / 2);
|
scrollToLineInDocument(cursorLineInDocument() - linesOnScreen() / 2);
|
||||||
|
if (key == '.')
|
||||||
moveToFirstNonBlankOnLine();
|
moveToFirstNonBlankOnLine();
|
||||||
finishMovement();
|
finishMovement();
|
||||||
} else if (key == 'z') { // center cursor line
|
} else if (key == '-' || key == 'b') { // cursor line to bottom of window
|
||||||
scrollToLineInDocument(cursorLineInDocument() - linesOnScreen() / 2);
|
if (!m_mvcount.isEmpty())
|
||||||
|
m_tc.setPosition(positionForLine(count()));
|
||||||
|
scrollToLineInDocument(cursorLineInDocument() - linesOnScreen() - 1);
|
||||||
|
if (key == '-')
|
||||||
|
moveToFirstNonBlankOnLine();
|
||||||
finishMovement();
|
finishMovement();
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "IGNORED Z_MODE " << key << text;
|
qDebug() << "IGNORED Z_MODE " << key << text;
|
||||||
|
Reference in New Issue
Block a user