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
Marco Bubke
flatpak-qt-creator
Commits
4d6b2905
Commit
4d6b2905
authored
Dec 25, 2008
by
hjk
Committed by
Roberto Raggi
Dec 29, 2008
Browse files
get 3d2w right
parent
fe261f0a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/plugins/fakevim/handler.cpp
View file @
4d6b2905
...
...
@@ -106,7 +106,9 @@ public:
void
search
(
const
QString
&
needle
,
bool
backwards
);
void
showMessage
(
const
QString
&
msg
);
int
count
()
const
{
return
m_count
.
isEmpty
()
?
1
:
m_count
.
toInt
();
}
int
mvCount
()
const
{
return
m_mvcount
.
isEmpty
()
?
1
:
m_mvcount
.
toInt
();
}
int
opCount
()
const
{
return
m_opcount
.
isEmpty
()
?
1
:
m_opcount
.
toInt
();
}
int
count
()
const
{
return
mvCount
()
*
opCount
();
}
int
leftDist
()
const
{
return
m_tc
.
position
()
-
m_tc
.
block
().
position
();
}
int
rightDist
()
const
{
return
m_tc
.
block
().
length
()
-
leftDist
()
-
1
;
}
bool
atEol
()
const
{
return
m_tc
.
atBlockEnd
()
&&
m_tc
.
block
().
length
()
>
1
;
}
...
...
@@ -132,7 +134,8 @@ public:
QTextCursor
m_tc
;
QHash
<
int
,
QString
>
m_registers
;
int
m_register
;
QString
m_count
;
QString
m_mvcount
;
QString
m_opcount
;
QStack
<
QString
>
m_undoStack
;
QStack
<
QString
>
m_redoStack
;
...
...
@@ -228,7 +231,8 @@ void FakeVimHandler::Private::finishMovement()
if
(
atEol
())
m_tc
.
movePosition
(
Left
,
MoveAnchor
,
1
);
}
m_count
.
clear
();
m_mvcount
.
clear
();
m_opcount
.
clear
();
m_register
=
'"'
;
m_tc
.
clearSelection
();
updateCommandBuffer
();
...
...
@@ -275,11 +279,11 @@ void FakeVimHandler::Private::handleCommandMode(int key, const QString &text)
}
m_submode
=
NoSubMode
;
}
else
if
(
key
>=
'0'
&&
key
<=
'9'
)
{
if
(
key
==
'0'
&&
m_count
.
isEmpty
())
{
if
(
key
==
'0'
&&
m_
mv
count
.
isEmpty
())
{
m_tc
.
movePosition
(
StartOfLine
,
KeepAnchor
);
finishMovement
();
}
else
{
m_count
.
append
(
QChar
(
key
));
m_
mv
count
.
append
(
QChar
(
key
));
}
}
else
if
(
key
==
':'
||
key
==
'/'
||
key
==
'?'
)
{
m_commandCode
=
key
;
...
...
@@ -318,6 +322,8 @@ void FakeVimHandler::Private::handleCommandMode(int key, const QString &text)
}
else
if
(
key
==
'd'
)
{
if
(
atEol
())
m_tc
.
movePosition
(
Left
,
MoveAnchor
,
1
);
m_opcount
=
m_mvcount
;
m_mvcount
.
clear
();
m_submode
=
DeleteSubMode
;
}
else
if
(
key
==
'D'
)
{
m_submode
=
DeleteSubMode
;
...
...
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