Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
flatpak-qt-creator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marco Bubke
flatpak-qt-creator
Commits
0d5ea465
Commit
0d5ea465
authored
16 years ago
by
Martin Aumueller
Committed by
hjk
16 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fakevim: implement 'y' for copying
parent
0977776f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/fakevim/fakevimhandler.cpp
+19
-1
19 additions, 1 deletion
src/plugins/fakevim/fakevimhandler.cpp
with
19 additions
and
1 deletion
src/plugins/fakevim/fakevimhandler.cpp
+
19
−
1
View file @
0d5ea465
...
...
@@ -97,6 +97,7 @@ enum SubMode
ChangeSubMode
,
DeleteSubMode
,
FilterSubMode
,
YankSubMode
,
ZSubMode
,
};
...
...
@@ -263,6 +264,9 @@ public:
// vi style configuration
QHash
<
QString
,
QString
>
m_config
;
// for restoring cursor position
int
m_savedPosition
;
};
FakeVimHandler
::
Private
::
Private
(
FakeVimHandler
*
parent
)
...
...
@@ -332,6 +336,7 @@ bool FakeVimHandler::Private::handleKey(int key, const QString &text)
{
//qDebug() << "KEY: " << key << text << "POS: " << m_tc.position();
//qDebug() << "\nUNDO: " << m_undoStack << "\nREDO: " << m_redoStack;
m_savedPosition
=
m_tc
.
position
();
if
(
m_mode
==
InsertMode
)
return
handleInsertMode
(
key
,
text
);
if
(
m_mode
==
CommandMode
)
...
...
@@ -372,6 +377,10 @@ void FakeVimHandler::Private::finishMovement(const QString &dotCommand)
m_submode
=
NoSubMode
;
if
(
atEol
())
m_tc
.
movePosition
(
Left
,
MoveAnchor
,
1
);
}
else
if
(
m_submode
==
YankSubMode
)
{
m_registers
[
m_register
]
=
m_tc
.
selectedText
();
m_tc
.
setPosition
(
m_savedPosition
);
m_submode
=
NoSubMode
;
}
m_mvcount
.
clear
();
m_opcount
.
clear
();
...
...
@@ -517,6 +526,11 @@ bool FakeVimHandler::Private::handleCommandMode(int key, const QString &text)
m_tc
.
movePosition
(
Down
,
KeepAnchor
,
count
());
m_registers
[
m_register
]
=
m_tc
.
selectedText
();
finishMovement
(
"d"
);
}
else
if
(
m_submode
==
YankSubMode
&&
key
==
'y'
)
{
m_tc
.
movePosition
(
StartOfLine
,
MoveAnchor
);
m_tc
.
movePosition
(
Down
,
KeepAnchor
,
count
());
m_registers
[
m_register
]
=
m_tc
.
selectedText
();
finishMovement
();
}
else
if
(
m_submode
==
ZSubMode
)
{
if
(
key
==
Key_Return
)
{
// cursor line to top of window, cursor on first non-blank
...
...
@@ -779,6 +793,10 @@ bool FakeVimHandler::Private::handleCommandMode(int key, const QString &text)
m_tc
.
deleteChar
();
}
finishMovement
();
}
else
if
(
key
==
'y'
)
{
if
(
atEol
())
m_tc
.
movePosition
(
Left
,
MoveAnchor
,
1
);
m_submode
=
YankSubMode
;
}
else
if
(
key
==
'z'
)
{
m_submode
=
ZSubMode
;
}
else
if
(
key
==
'~'
&&
!
atEol
())
{
...
...
@@ -945,7 +963,7 @@ int FakeVimHandler::Private::readLineCode(QString &cmd)
if
(
c
==
'\''
&&
!
cmd
.
isEmpty
())
{
int
mark
=
m_marks
.
value
(
cmd
.
at
(
0
).
unicode
());
if
(
!
mark
)
{
showMessage
(
tr
(
"E20: Mark '%1' not set"
).
arg
(
cmd
.
at
(
0
)));
show
Red
Message
(
tr
(
"E20: Mark '%1' not set"
).
arg
(
cmd
.
at
(
0
)));
return
-
1
;
}
cmd
=
cmd
.
mid
(
1
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment