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();
moveUp(count() * (linesOnScreen() - 2));
m_lastInsertion.clear();
} else if (input.isKey(Key_Tab) && hasConfig(ConfigExpandTab)) {
} else if (input.isKey(Key_Tab)) {
m_justAutoIndented = 0;
if (hasConfig(ConfigExpandTab)) {
const int ts = config(ConfigTabStop).toInt();
const int col = logicalCursorColumn();
QString str = QString(ts - col % ts, ' ');
m_lastInsertion.append(str);
insertText(str);
setTargetColumn();
} else {
insertInInsertMode(input.raw());
}
} else if (input.isControl('d')) {
// remove one level of indentation from the current line
int shift = config(ConfigShiftWidth).toInt();