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
27c77134
Commit
27c77134
authored
Jan 28, 2009
by
hjk
Browse files
Fixes: fakevim: rough Ctrl-O/Ctrl-I implementation
parent
3f08a9d2
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/plugins/fakevim/fakevimhandler.cpp
View file @
27c77134
...
...
@@ -348,6 +348,10 @@ public:
QPointer
<
QObject
>
m_extraData
;
int
m_cursorWidth
;
void
recordJump
();
QList
<
int
>
m_jumpListUndo
;
QList
<
int
>
m_jumpListRedo
;
};
FakeVimHandler
::
Private
::
Private
(
FakeVimHandler
*
parent
,
QWidget
*
widget
)
...
...
@@ -797,6 +801,7 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
m_lastSearchForward
=
(
key
==
'*'
);
updateMiniBuffer
();
search
(
needle
,
m_lastSearchForward
);
recordJump
();
}
else
if
(
key
==
'\''
)
{
m_subsubmode
=
TickSubSubMode
;
}
else
if
(
key
==
'|'
)
{
...
...
@@ -946,6 +951,11 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
moveToStartOfLine
();
else
moveToFirstNonBlankOnLine
();
}
else
if
(
key
==
control
(
'i'
))
{
if
(
!
m_jumpListRedo
.
isEmpty
())
{
m_jumpListUndo
.
append
(
position
());
m_tc
.
setPosition
(
m_jumpListRedo
.
takeLast
());
}
}
else
if
(
key
==
'j'
||
key
==
Key_Down
)
{
int
savedColumn
=
m_desiredColumn
;
if
(
m_submode
==
NoSubMode
||
m_submode
==
ZSubMode
...
...
@@ -1001,8 +1011,10 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
finishMovement
();
}
else
if
(
key
==
'n'
)
{
search
(
lastSearchString
(),
m_lastSearchForward
);
recordJump
();
}
else
if
(
key
==
'N'
)
{
search
(
lastSearchString
(),
!
m_lastSearchForward
);
recordJump
();
}
else
if
(
key
==
'o'
||
key
==
'O'
)
{
recordBeginGroup
();
recordMove
();
...
...
@@ -1018,6 +1030,11 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
recordInsertText
(
QString
(
indentDist
(),
' '
));
else
recordInsertText
(
QString
(
numSpaces
,
' '
));
}
else
if
(
key
==
control
(
'o'
))
{
if
(
!
m_jumpListUndo
.
isEmpty
())
{
m_jumpListRedo
.
append
(
position
());
m_tc
.
setPosition
(
m_jumpListUndo
.
takeLast
());
}
}
else
if
(
key
==
'p'
||
key
==
'P'
)
{
recordBeginGroup
();
QString
text
=
m_registers
[
m_register
];
...
...
@@ -1298,6 +1315,7 @@ bool FakeVimHandler::Private::handleMiniBufferModes(int key, int unmodified,
m_searchHistory
.
append
(
m_commandBuffer
);
m_lastSearchForward
=
(
m_mode
==
SearchForwardMode
);
search
(
lastSearchString
(),
m_lastSearchForward
);
recordJump
();
}
enterCommandMode
();
updateMiniBuffer
();
...
...
@@ -2106,6 +2124,13 @@ void FakeVimHandler::Private::quit()
}
void
FakeVimHandler
::
Private
::
recordJump
()
{
m_jumpListUndo
.
append
(
position
());
m_jumpListRedo
.
clear
();
//qDebug() << m_jumpListUndo;
}
///////////////////////////////////////////////////////////////////////
//
// FakeVimHandler
...
...
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