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
10387642
Commit
10387642
authored
Dec 25, 2008
by
hjk
Committed by
Roberto Raggi
Dec 29, 2008
Browse files
partially implement 'b' and 'B'
parent
eb132a4c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/plugins/fakevim/handler.cpp
View file @
10387642
...
...
@@ -545,17 +545,20 @@ static int charClass(QChar c, bool simple)
void
FakeVimHandler
::
Private
::
moveToWordBegin
(
int
repeat
,
bool
simple
)
{
QTextDocument
*
doc
=
m_tc
.
document
();
int
n
=
lastPositionInDocument
()
-
1
;
int
lastClass
=
0
;
while
(
m_tc
.
position
()
<
n
)
{
while
(
true
)
{
m_tc
.
movePosition
(
Left
,
KeepAnchor
,
1
);
QChar
c
=
doc
->
characterAt
(
m_tc
.
position
());
int
thisClass
=
charClass
(
c
,
simple
);
if
(
thisClass
!=
lastClass
&&
this
Class
!=
0
)
if
(
thisClass
!=
lastClass
&&
last
Class
!=
0
)
--
repeat
;
if
(
repeat
==
-
1
)
return
;
if
(
repeat
==
-
1
)
{
m_tc
.
movePosition
(
Right
,
KeepAnchor
,
1
);
break
;
}
lastClass
=
thisClass
;
m_tc
.
movePosition
(
Right
,
KeepAnchor
,
1
);
if
(
m_tc
.
position
()
==
0
)
break
;
}
}
...
...
@@ -564,17 +567,19 @@ void FakeVimHandler::Private::moveToWordEnd(int repeat, bool simple)
QTextDocument
*
doc
=
m_tc
.
document
();
int
n
=
lastPositionInDocument
()
-
1
;
int
lastClass
=
0
;
while
(
m_tc
.
position
()
<
n
)
{
while
(
true
)
{
m_tc
.
movePosition
(
Right
,
KeepAnchor
,
1
);
QChar
c
=
doc
->
characterAt
(
m_tc
.
position
());
int
thisClass
=
charClass
(
c
,
simple
);
if
(
thisClass
!=
lastClass
&&
lastClass
!=
0
)
--
repeat
;
if
(
repeat
==
-
1
)
{
if
(
repeat
==
0
)
{
m_tc
.
movePosition
(
Left
,
KeepAnchor
,
1
);
re
turn
;
b
re
ak
;
}
lastClass
=
thisClass
;
m_tc
.
movePosition
(
Right
,
KeepAnchor
,
1
);
if
(
m_tc
.
position
()
==
n
)
break
;
}
}
...
...
@@ -584,7 +589,7 @@ void FakeVimHandler::Private::moveToNextWord(int repeat, bool simple)
QTextDocument
*
doc
=
m_tc
.
document
();
int
n
=
lastPositionInDocument
()
-
1
;
int
lastClass
=
0
;
while
(
m_tc
.
position
()
<
n
)
{
while
(
true
)
{
QChar
c
=
doc
->
characterAt
(
m_tc
.
position
());
int
thisClass
=
charClass
(
c
,
simple
);
if
(
thisClass
!=
lastClass
&&
thisClass
!=
0
)
...
...
@@ -593,6 +598,8 @@ void FakeVimHandler::Private::moveToNextWord(int repeat, bool simple)
break
;
lastClass
=
thisClass
;
m_tc
.
movePosition
(
Right
,
KeepAnchor
,
1
);
if
(
m_tc
.
position
()
==
n
)
break
;
}
}
...
...
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