fakevim: fix insertion of tabs in insert mode

(cherry picked from commit 474ec252a23745bf5106b239054c17d7dfc2fbf2)
This commit is contained in:
hjk
2010-07-06 15:12:24 +02:00
parent 5f67f7c42b
commit cd433a52de

View File

@@ -2644,14 +2644,18 @@ EventResult FakeVimHandler::Private::handleInsertMode(const Input &input)
removeAutomaticIndentation(); removeAutomaticIndentation();
moveUp(count() * (linesOnScreen() - 2)); moveUp(count() * (linesOnScreen() - 2));
m_lastInsertion.clear(); m_lastInsertion.clear();
} else if (input.isKey(Key_Tab) && hasConfig(ConfigExpandTab)) { } else if (input.isKey(Key_Tab)) {
m_justAutoIndented = 0; m_justAutoIndented = 0;
const int ts = config(ConfigTabStop).toInt(); if (hasConfig(ConfigExpandTab)) {
const int col = logicalCursorColumn(); const int ts = config(ConfigTabStop).toInt();
QString str = QString(ts - col % ts, ' '); const int col = logicalCursorColumn();
m_lastInsertion.append(str); QString str = QString(ts - col % ts, ' ');
insertText(str); m_lastInsertion.append(str);
setTargetColumn(); insertText(str);
setTargetColumn();
} else {
insertInInsertMode(input.raw());
}
} else if (input.isControl('d')) { } else if (input.isControl('d')) {
// remove one level of indentation from the current line // remove one level of indentation from the current line
int shift = config(ConfigShiftWidth).toInt(); int shift = config(ConfigShiftWidth).toInt();