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
57aad474
Commit
57aad474
authored
Apr 09, 2009
by
hjk
Browse files
fakevim: work on autotests
parent
353025f3
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/fakevim/fakevimhandler.cpp
View file @
57aad474
...
...
@@ -607,22 +607,28 @@ EventResult FakeVimHandler::Private::handleKey(int key, int unmodified,
void
FakeVimHandler
::
Private
::
moveDown
(
int
n
)
{
// m_tc.movePosition(Down, MoveAnchor, n); does not work for "hidden"
// documents like in the autotests
#if 0
// does not work for "hidden" documents like in the autotests
m_tc.movePosition(Down, MoveAnchor, n);
#else
const
QTextBlock
&
block
=
m_tc
.
block
();
const
int
col
=
m_tc
.
position
()
-
block
.
position
();
const
int
line
=
block
.
blockNumber
();
const
int
pos
=
m_tc
.
document
()
->
findBlockByNumber
(
line
+
n
).
position
();
setPosition
(
pos
+
qMin
(
block
.
length
(),
col
));
setPosition
(
pos
);
#endif
}
void
FakeVimHandler
::
Private
::
moveToEndOfLine
()
{
// m_tc.movePosition(EndOfLine, MoveAnchor) does not work for "hidden"
// documents like in the autotests
#if 0
// does not work for "hidden" documents like in the autotests
m_tc.movePosition(EndOfLine, MoveAnchor);
#else
const
QTextBlock
&
block
=
m_tc
.
block
();
setPosition
(
block
.
position
()
+
block
.
length
()
-
1
);
#endif
}
void
FakeVimHandler
::
Private
::
finishMovement
(
const
QString
&
dotCommand
)
...
...
tests/auto/fakevim/main.cpp
View file @
57aad474
...
...
@@ -30,6 +30,8 @@
#include
"fakevimhandler.h"
#include
<QtCore/QSet>
#include
<QtGui/QTextEdit>
#include
<QtGui/QPlainTextEdit>
#include
<QtTest/QtTest>
...
...
@@ -66,6 +68,7 @@ private:
const
char
*
file
,
int
line
);
QString
insertCursor
(
const
QString
&
needle0
);
//QTextEdit m_editor;
QPlainTextEdit
m_editor
;
FakeVimHandler
m_handler
;
QList
<
QTextEdit
::
ExtraSelection
>
m_selection
;
...
...
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