forked from qt-creator/qt-creator
FakeVim: Accept suggestion with Tab Key
* Changed signals to callbacks as only one receiver was ever added * Added "tabPressedInInsertMode" callback to allow accepting a suggestion with the Tab Key Fixes: QTCREATORBUG-28830 Change-Id: Ie70ba595b8802b6100fff495164d8e0471b1354c Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -5459,16 +5459,18 @@ void FakeVimHandler::Private::handleInsertMode(const Input &input)
|
||||
} else if (input.isKey(Key_PageUp) || input.isControl('b')) {
|
||||
movePageUp();
|
||||
} else if (input.isKey(Key_Tab)) {
|
||||
m_buffer->insertState.insertingSpaces = true;
|
||||
if (s.expandTab.value()) {
|
||||
const int ts = s.tabStop.value();
|
||||
const int col = logicalCursorColumn();
|
||||
QString str = QString(ts - col % ts, ' ');
|
||||
insertText(str);
|
||||
} else {
|
||||
insertInInsertMode(input.raw());
|
||||
if (q->tabPressedInInsertMode()) {
|
||||
m_buffer->insertState.insertingSpaces = true;
|
||||
if (s.expandTab.value()) {
|
||||
const int ts = s.tabStop.value();
|
||||
const int col = logicalCursorColumn();
|
||||
QString str = QString(ts - col % ts, ' ');
|
||||
insertText(str);
|
||||
} else {
|
||||
insertInInsertMode(input.raw());
|
||||
}
|
||||
m_buffer->insertState.insertingSpaces = false;
|
||||
}
|
||||
m_buffer->insertState.insertingSpaces = false;
|
||||
} else if (input.isControl('d')) {
|
||||
// remove one level of indentation from the current line
|
||||
const int shift = s.shiftWidth.value();
|
||||
|
||||
Reference in New Issue
Block a user