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
Tobias Hunger
qt-creator
Commits
79f0f6e3
Commit
79f0f6e3
authored
Jul 29, 2009
by
Erik Verbruggen
Browse files
Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline
parents
57e5ba08
519b2d21
Changes
1
Show whitespace changes
Inline
Side-by-side
src/plugins/fakevim/fakevimhandler.cpp
View file @
79f0f6e3
...
...
@@ -1564,30 +1564,34 @@ EventResult FakeVimHandler::Private::handleInsertMode(int key, int,
}
}
else
if
(
key
==
Key_Left
)
{
moveLeft
(
count
());
setTargetColumn
();
m_lastInsertion
.
clear
();
}
else
if
(
key
==
Key_Down
)
{
removeAutomaticIndentation
();
//
removeAutomaticIndentation();
m_submode
=
NoSubMode
;
moveDown
(
count
());
m_lastInsertion
.
clear
();
}
else
if
(
key
==
Key_Up
)
{
removeAutomaticIndentation
();
//
removeAutomaticIndentation();
m_submode
=
NoSubMode
;
moveUp
(
count
());
m_lastInsertion
.
clear
();
}
else
if
(
key
==
Key_Right
)
{
moveRight
(
count
());
setTargetColumn
();
m_lastInsertion
.
clear
();
}
else
if
(
key
==
Key_Return
)
{
m_submode
=
NoSubMode
;
m_tc
.
insertBlock
();
m_lastInsertion
+=
"
\n
"
;
insertAutomaticIndentation
(
true
);
setTargetColumn
();
}
else
if
(
key
==
Key_Backspace
||
key
==
control
(
'h'
))
{
if
(
!
removeAutomaticIndentation
())
if
(
!
m_lastInsertion
.
isEmpty
()
||
hasConfig
(
ConfigBackspace
,
"start"
))
{
m_tc
.
deletePreviousChar
();
m_lastInsertion
.
chop
(
1
);
setTargetColumn
();
}
}
else
if
(
key
==
Key_Delete
)
{
m_tc
.
deleteChar
();
...
...
@@ -1604,6 +1608,7 @@ EventResult FakeVimHandler::Private::handleInsertMode(int key, int,
QString
str
=
QString
(
theFakeVimSetting
(
ConfigTabStop
)
->
value
().
toInt
(),
' '
);
m_lastInsertion
.
append
(
str
);
m_tc
.
insertText
(
str
);
setTargetColumn
();
}
else
if
(
key
>=
control
(
'a'
)
&&
key
<=
control
(
'z'
))
{
// ignore these
}
else
if
(
!
text
.
isEmpty
())
{
...
...
@@ -1625,6 +1630,7 @@ EventResult FakeVimHandler::Private::handleInsertMode(int key, int,
if
(
!
m_inReplay
)
emit
q
->
completionRequested
();
setTargetColumn
();
}
else
{
return
EventUnhandled
;
}
...
...
@@ -2200,14 +2206,14 @@ void FakeVimHandler::Private::shiftRegionLeft(int repeat)
void
FakeVimHandler
::
Private
::
moveToTargetColumn
()
{
const
QTextBlock
&
block
=
m_tc
.
block
();
int
col
=
m_tc
.
position
()
-
m_tc
.
block
()
.
position
();
int
col
=
m_tc
.
position
()
-
block
.
position
();
if
(
col
==
m_targetColumn
)
return
;
//qDebug() << "CORRECTING COLUMN FROM: " << col << "TO" << m_targetColumn;
if
(
m_targetColumn
==
-
1
||
m_tc
.
block
()
.
length
()
<=
m_targetColumn
)
m_tc
.
setPosition
(
block
.
position
()
+
block
.
length
()
-
1
,
Keep
Anchor
);
if
(
m_targetColumn
==
-
1
||
block
.
length
()
<=
m_targetColumn
)
m_tc
.
setPosition
(
block
.
position
()
+
block
.
length
()
-
1
,
Move
Anchor
);
else
m_tc
.
setPosition
(
m_tc
.
block
()
.
position
()
+
m_targetColumn
,
Keep
Anchor
);
m_tc
.
setPosition
(
block
.
position
()
+
m_targetColumn
,
Move
Anchor
);
}
/* if simple is given:
...
...
Write
Preview
Markdown
is supported
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