Skip to content
GitLab
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
5076be59
Commit
5076be59
authored
Apr 16, 2009
by
hjk
Browse files
fakevim: fix cursor position for <n>j or <n>k and end or begin of document
parent
c172e9b1
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/fakevim/fakevimhandler.cpp
View file @
5076be59
...
...
@@ -620,8 +620,9 @@ void FakeVimHandler::Private::moveDown(int n)
m_tc.movePosition(Down, MoveAnchor, n);
#else
const
int
col
=
m_tc
.
position
()
-
m_tc
.
block
().
position
();
const
int
line
=
m_tc
.
block
().
blockNumber
();
const
QTextBlock
&
block
=
m_tc
.
document
()
->
findBlockByNumber
(
line
+
n
);
const
int
lastLine
=
m_tc
.
document
()
->
lastBlock
().
blockNumber
();
const
int
targetLine
=
qMax
(
0
,
qMin
(
lastLine
,
m_tc
.
block
().
blockNumber
()
+
n
));
const
QTextBlock
&
block
=
m_tc
.
document
()
->
findBlockByNumber
(
targetLine
);
const
int
pos
=
block
.
position
();
setPosition
(
pos
+
qMin
(
block
.
length
()
-
1
,
col
));
moveToTargetColumn
();
...
...
tests/auto/fakevim/main.cpp
View file @
5076be59
...
...
@@ -302,6 +302,7 @@ void tst_FakeVim::command_e()
move
(
"e"
,
"int main(int argc, char *arg@v[])"
);
move
(
"e"
,
"int main(int argc, char *argv[]@)"
);
move
(
"e"
,
"@{"
);
move
(
"10k"
,
"@
\n
"
);
// home.
}
void
tst_FakeVim
::
command_i
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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