forked from qt-creator/qt-creator
handle 'P'
This commit is contained in:
@@ -299,7 +299,7 @@ bool FakeVimHandler::Private::eventFilter(QObject *ob, QEvent *ev)
|
|||||||
key += 32;
|
key += 32;
|
||||||
if ((keyEvent->modifiers() & Qt::ControlModifier) != 0)
|
if ((keyEvent->modifiers() & Qt::ControlModifier) != 0)
|
||||||
key += 256;
|
key += 256;
|
||||||
handleKey(key, keyEvent->text());
|
bool handled = handleKey(key, keyEvent->text());
|
||||||
|
|
||||||
// We fake vi-style end-of-line behaviour
|
// We fake vi-style end-of-line behaviour
|
||||||
m_fakeEnd = (atEol() && m_mode == CommandMode);
|
m_fakeEnd = (atEol() && m_mode == CommandMode);
|
||||||
@@ -309,7 +309,7 @@ bool FakeVimHandler::Private::eventFilter(QObject *ob, QEvent *ev)
|
|||||||
|
|
||||||
EDITOR(setTextCursor(m_tc));
|
EDITOR(setTextCursor(m_tc));
|
||||||
EDITOR(ensureCursorVisible());
|
EDITOR(ensureCursorVisible());
|
||||||
return true;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FakeVimHandler::Private::handleKey(int key, const QString &text)
|
bool FakeVimHandler::Private::handleKey(int key, const QString &text)
|
||||||
@@ -669,15 +669,17 @@ bool FakeVimHandler::Private::handleCommandMode(int key, const QString &text)
|
|||||||
m_tc.movePosition(StartOfLine, MoveAnchor);
|
m_tc.movePosition(StartOfLine, MoveAnchor);
|
||||||
m_tc.movePosition(Left, MoveAnchor, 1);
|
m_tc.movePosition(Left, MoveAnchor, 1);
|
||||||
m_tc.insertText("\n");
|
m_tc.insertText("\n");
|
||||||
} else if (key == 'p') {
|
} else if (key == 'p' || key == 'P') {
|
||||||
QString text = m_registers[m_register];
|
QString text = m_registers[m_register];
|
||||||
int n = text.count(QChar(ParagraphSeparator));
|
int n = text.count(QChar(ParagraphSeparator));
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
m_tc.movePosition(StartOfLine);
|
m_tc.movePosition(StartOfLine);
|
||||||
|
if (key == 'p')
|
||||||
m_tc.movePosition(Down);
|
m_tc.movePosition(Down);
|
||||||
m_tc.insertText(text);
|
m_tc.insertText(text);
|
||||||
m_tc.movePosition(Up, MoveAnchor, n);
|
m_tc.movePosition(Up, MoveAnchor, n);
|
||||||
} else {
|
} else {
|
||||||
|
if (key == 'p')
|
||||||
m_tc.movePosition(Right);
|
m_tc.movePosition(Right);
|
||||||
m_tc.insertText(text);
|
m_tc.insertText(text);
|
||||||
m_tc.movePosition(Left);
|
m_tc.movePosition(Left);
|
||||||
|
|||||||
Reference in New Issue
Block a user