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
d78d5f56
Commit
d78d5f56
authored
Jan 16, 2009
by
hjk
Browse files
fakevim: fix 'e' and 'E'
parent
9100e963
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/plugins/fakevim/fakevimhandler.cpp
View file @
d78d5f56
...
...
@@ -433,6 +433,7 @@ void FakeVimHandler::Private::finishMovement(const QString &dotCommand)
if
(
!
dotCommand
.
isEmpty
())
m_dotCommand
=
"c"
+
dotCommand
;
QString
text
=
recordRemoveSelectedText
();
qDebug
()
<<
"CHANGING TO INSERT MODE"
<<
text
;
m_registers
[
m_register
]
=
text
;
m_mode
=
InsertMode
;
m_submode
=
NoSubMode
;
...
...
@@ -949,7 +950,12 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
}
else
if
(
key
==
control
(
'v'
))
{
enterVisualMode
(
VisualBlockMode
);
}
else
if
(
key
==
'w'
)
{
moveToNextWord
(
false
);
// Special case: "cw" and "cW" work the same as "ce" and "cE" if the
// cursor is on a non-blank.
if
(
m_submode
==
ChangeSubMode
)
moveToWordBoundary
(
false
,
true
);
else
moveToNextWord
(
false
);
finishMovement
(
"w"
);
}
else
if
(
key
==
'W'
)
{
moveToNextWord
(
true
);
...
...
@@ -1513,15 +1519,15 @@ void FakeVimHandler::Private::moveToWordBoundary(bool simple, bool forward)
int
repeat
=
count
();
QTextDocument
*
doc
=
m_tc
.
document
();
int
n
=
forward
?
lastPositionInDocument
()
-
1
:
0
;
int
lastClass
=
0
;
int
lastClass
=
-
1
;
while
(
true
)
{
m_tc
.
movePosition
(
forward
?
Right
:
Left
,
KeepAnchor
,
1
);
forward
?
move
Right
()
:
moveLeft
(
);
QChar
c
=
doc
->
characterAt
(
m_tc
.
position
());
int
thisClass
=
charClass
(
c
,
simple
);
if
(
thisClass
!=
lastClass
&&
lastClass
!=
0
)
--
repeat
;
if
(
repeat
==
-
1
)
{
m_tc
.
movePosition
(
forward
?
Left
:
Right
,
KeepAnchor
,
1
);
forward
?
move
Left
()
:
move
Right
(
);
break
;
}
lastClass
=
thisClass
;
...
...
@@ -1586,7 +1592,7 @@ void FakeVimHandler::Private::moveToNextWord(bool simple)
if
(
repeat
==
0
)
break
;
lastClass
=
thisClass
;
m
_tc
.
movePosition
(
Right
,
KeepAnchor
,
1
);
m
oveRight
(
);
if
(
m_tc
.
position
()
==
n
)
break
;
}
...
...
@@ -1799,11 +1805,13 @@ void FakeVimHandler::Private::recordEndGroup()
QString
FakeVimHandler
::
Private
::
recordRemoveSelectedText
()
{
EditOperation
op
;
//qDebug() << "1 POS: " << position() << " ANCHOR: " << anchor() << m_tc.anchor();
m_tc
.
setPosition
(
anchor
(),
KeepAnchor
);
op
.
m_position
=
qMin
(
position
(),
anchor
());
//qDebug() << "2 POS: " << position() << " ANCHOR: " << anchor() << m_tc.anchor();
op
.
m_from
=
m_tc
.
selection
().
toPlainText
();
recordOperation
(
op
);
m_tc
.
removeS
ele
c
te
dText
();
m_tc
.
d
elete
Char
();
return
op
.
m_from
;
}
...
...
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