FakeVim: Fix dot command for pasting

Fixes: QTCREATORBUG-25281
Change-Id: Ic36b87672889442520941bcefa0f5ee14b77fbc6
Reviewed-by: Lukas Holecek <hluk@email.cz>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Tom Praschan
2021-01-26 18:15:03 +01:00
committed by Tom Praschan
parent bcde1ead55
commit b1f1ecb1b5
2 changed files with 11 additions and 0 deletions

View File

@@ -2526,6 +2526,15 @@ void FakeVimPlugin::test_vim_copy_paste()
KEYS("gg\"yP", X "def" N "abc" N "abc" N "def" N "ghi");
KEYS("\"xP", X "abc" N "def" N "abc" N "abc" N "def" N "ghi");
// QTCREATORBUG-25281
data.setText(X "abc" N "def" N "ghi");
KEYS("\"xyy", X "abc" N "def" N "ghi");
KEYS("\"xp", "abc" N X "abc" N "def" N "ghi");
KEYS("j", "abc" N "abc" N X "def" N "ghi");
KEYS("yy", "abc" N "abc" N X "def" N "ghi");
KEYS("\"xp", "abc" N "abc" N "def" N X "abc" N "ghi");
KEYS(".", "abc" N "abc" N "def" N "abc" N X "abc" N "ghi");
// delete to black hole register
data.setText("aaa bbb ccc");
KEYS("yiww\"_diwP", "aaa aaa ccc");

View File

@@ -4520,6 +4520,8 @@ bool FakeVimHandler::Private::handleNoSubMode(const Input &input)
} else if (input.isControl('o')) {
jump(-count());
} else if (input.is('p') || input.is('P') || input.isShift(Qt::Key_Insert)) {
dotCommand = QString("\"%1%2p").arg(QChar(m_register)).arg(count());
pasteText(!input.is('P'));
setTargetColumn();
finishMovement();