Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
aa6c5526
Commit
aa6c5526
authored
May 05, 2009
by
hjk
Browse files
fakevim: better cursor poistioning after indenting
parent
ed853ee4
Changes
1
Show whitespace changes
Inline
Side-by-side
src/plugins/fakevim/fakevimhandler.cpp
View file @
aa6c5526
...
...
@@ -698,8 +698,10 @@ void FakeVimHandler::Private::finishMovement(const QString &dotCommand)
}
else
if
(
m_submode
==
ReplaceSubMode
)
{
m_submode
=
NoSubMode
;
}
else
if
(
m_submode
==
IndentSubMode
)
{
recordJump
();
indentRegion
();
m_submode
=
NoSubMode
;
updateMiniBuffer
();
}
else
if
(
m_submode
==
ShiftRightSubMode
)
{
recordJump
();
shiftRegionRight
(
1
);
...
...
@@ -2057,8 +2059,13 @@ void FakeVimHandler::Private::indentRegion(QChar typedChar)
int
endLine
=
lineForPosition
(
position
());
if
(
beginLine
>
endLine
)
qSwap
(
beginLine
,
endLine
);
int
amount
=
0
;
emit
q
->
indentRegion
(
&
amount
,
beginLine
,
endLine
,
typedChar
);
setPosition
(
firstPositionInLine
(
beginLine
));
moveToFirstNonBlankOnLine
();
setTargetColumn
();
setDotCommand
(
"%1=="
,
endLine
-
beginLine
+
1
);
}
...
...
@@ -2072,8 +2079,6 @@ void FakeVimHandler::Private::shiftRegionRight(int repeat)
QString
indent
(
len
,
' '
);
int
firstPos
=
firstPositionInLine
(
beginLine
);
//setPosition(firstPos);
for
(
int
line
=
beginLine
;
line
<=
endLine
;
++
line
)
{
setPosition
(
firstPositionInLine
(
line
));
m_tc
.
insertText
(
indent
);
...
...
@@ -2081,6 +2086,7 @@ void FakeVimHandler::Private::shiftRegionRight(int repeat)
setPosition
(
firstPos
);
moveToFirstNonBlankOnLine
();
setTargetColumn
();
setDotCommand
(
"%1>>"
,
endLine
-
beginLine
+
1
);
}
...
...
@@ -2094,8 +2100,6 @@ void FakeVimHandler::Private::shiftRegionLeft(int repeat)
int
tab
=
config
(
ConfigTabStop
).
toInt
();
int
firstPos
=
firstPositionInLine
(
beginLine
);
//setPosition(firstPos);
for
(
int
line
=
beginLine
;
line
<=
endLine
;
++
line
)
{
int
pos
=
firstPositionInLine
(
line
);
setPosition
(
pos
);
...
...
@@ -2118,6 +2122,7 @@ void FakeVimHandler::Private::shiftRegionLeft(int repeat)
setPosition
(
firstPos
);
moveToFirstNonBlankOnLine
();
setTargetColumn
();
setDotCommand
(
"%1<<"
,
endLine
-
beginLine
+
1
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment