Commit a7cf72a9 authored by Martin Aumüller's avatar Martin Aumüller Committed by hjk

fakevim: improved 'startofline' behaviour for indenting and shifting left/right

Merge-request: 113
Reviewed-by: default avatarhjk <qtc-committer@nokia.com>
parent 21a9943b
......@@ -2657,6 +2657,7 @@ void FakeVimHandler::Private::moveToFirstNonBlankOnLine()
void FakeVimHandler::Private::indentSelectedText(QChar typedChar)
{
setTargetColumn();
int beginLine = qMin(lineForPosition(position()), lineForPosition(anchor()));
int endLine = qMax(lineForPosition(position()), lineForPosition(anchor()));
......@@ -2665,7 +2666,8 @@ void FakeVimHandler::Private::indentSelectedText(QChar typedChar)
indentText(range, typedChar);
setPosition(firstPositionInLine(beginLine));
moveToFirstNonBlankOnLine();
moveToTargetColumn();
handleStartOfLine();
setTargetColumn();
setDotCommand("%1==", endLine - beginLine + 1);
}
......@@ -2693,6 +2695,7 @@ bool FakeVimHandler::Private::isElectricCharacter(QChar c) const
void FakeVimHandler::Private::shiftRegionRight(int repeat)
{
setTargetColumn();
int beginLine = lineForPosition(anchor());
int endLine = lineForPosition(position());
if (beginLine > endLine)
......@@ -2709,13 +2712,15 @@ void FakeVimHandler::Private::shiftRegionRight(int repeat)
endEditBlock();
setPosition(firstPos);
moveToFirstNonBlankOnLine();
moveToTargetColumn();
handleStartOfLine();
setTargetColumn();
setDotCommand("%1>>", endLine - beginLine + 1);
}
void FakeVimHandler::Private::shiftRegionLeft(int repeat)
{
setTargetColumn();
int beginLine = lineForPosition(anchor());
int endLine = lineForPosition(position());
if (beginLine > endLine)
......@@ -2744,7 +2749,8 @@ void FakeVimHandler::Private::shiftRegionLeft(int repeat)
endEditBlock();
setPosition(firstPos);
moveToFirstNonBlankOnLine();
moveToTargetColumn();
handleStartOfLine();
setTargetColumn();
setDotCommand("%1<<", endLine - beginLine + 1);
}
......
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