Commit cd433a52 authored by hjk's avatar hjk
Browse files

fakevim: fix insertion of tabs in insert mode

(cherry picked from commit 474ec252a23745bf5106b239054c17d7dfc2fbf2)
parent 5f67f7c4
......@@ -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;
const int ts = config(ConfigTabStop).toInt();
const int col = logicalCursorColumn();
QString str = QString(ts - col % ts, ' ');
m_lastInsertion.append(str);
insertText(str);
setTargetColumn();
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();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment