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
04731b79
Commit
04731b79
authored
16 years ago
by
hjk
Browse files
Options
Downloads
Patches
Plain Diff
fakevim: implement Ctrl-e
parent
f7240bd6
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
+18
-4
18 additions, 4 deletions
src/plugins/fakevim/fakevimhandler.cpp
with
18 additions
and
4 deletions
src/plugins/fakevim/fakevimhandler.cpp
+
18
−
4
View file @
04731b79
...
...
@@ -250,6 +250,8 @@ private:
int
cursorColumnInDocument
()
const
;
int
linesInDocument
()
const
;
void
scrollToLineInDocument
(
int
line
);
void
scrollUp
(
int
count
);
void
scrollDown
(
int
count
)
{
scrollUp
(
-
count
);
}
// helper functions for indenting
bool
isElectricCharacter
(
QChar
c
)
const
...
...
@@ -531,7 +533,7 @@ EventResult FakeVimHandler::Private::handleEvent(QKeyEvent *ev)
moveLeft
();
EDITOR
(
setTextCursor
(
m_tc
));
EDITOR
(
ensureCursorVisible
());
//
EDITOR(ensureCursorVisible());
return
result
;
}
...
...
@@ -856,21 +858,21 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
if
(
key
==
Key_Return
||
key
==
't'
)
{
// cursor line to top of window
if
(
!
m_mvcount
.
isEmpty
())
setPosition
(
firstPositionInLine
(
count
()));
scroll
ToLineInDocument
(
cursorLine
InDocum
en
t
());
scroll
Up
(
-
cursorLine
OnScre
en
());
if
(
key
==
Key_Return
)
moveToFirstNonBlankOnLine
();
finishMovement
();
}
else
if
(
key
==
'.'
||
key
==
'z'
)
{
// cursor line to center of window
if
(
!
m_mvcount
.
isEmpty
())
setPosition
(
firstPositionInLine
(
count
()));
scroll
ToLineInDocument
(
cursorLineInDocument
()
-
lines
OnScreen
()
/
2
);
scroll
Up
(
linesOnScreen
()
/
2
-
cursorLine
OnScreen
());
if
(
key
==
'.'
)
moveToFirstNonBlankOnLine
();
finishMovement
();
}
else
if
(
key
==
'-'
||
key
==
'b'
)
{
// cursor line to bottom of window
if
(
!
m_mvcount
.
isEmpty
())
setPosition
(
firstPositionInLine
(
count
()));
scroll
ToLineInDocument
(
cursorLineInDocument
()
-
lines
OnScreen
()
-
1
);
scroll
Up
(
linesOnScreen
()
-
cursorLine
OnScreen
());
if
(
key
==
'-'
)
moveToFirstNonBlankOnLine
();
finishMovement
();
...
...
@@ -1110,6 +1112,12 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
m_moveType
=
MoveInclusive
;
moveToWordBoundary
(
true
,
true
);
finishMovement
();
}
else
if
(
key
==
control
(
'e'
))
{
// FIXME: this should use the "scroll" option, and "count"
if
(
cursorLineOnScreen
()
==
0
)
moveDown
(
1
);
scrollDown
(
1
);
finishMovement
();
}
else
if
(
key
==
'f'
)
{
m_subsubmode
=
FtSubSubMode
;
m_moveType
=
MoveInclusive
;
...
...
@@ -2154,9 +2162,15 @@ void FakeVimHandler::Private::scrollToLineInDocument(int line)
{
// FIXME: works only for QPlainTextEdit
QScrollBar
*
scrollBar
=
EDITOR
(
verticalScrollBar
());
//qDebug() << "SCROLL: " << scrollBar->value() << line;
scrollBar
->
setValue
(
line
);
}
void
FakeVimHandler
::
Private
::
scrollUp
(
int
count
)
{
scrollToLineInDocument
(
cursorLineInDocument
()
-
cursorLineOnScreen
()
-
count
);
}
int
FakeVimHandler
::
Private
::
lastPositionInDocument
()
const
{
QTextBlock
block
=
m_tc
.
block
().
document
()
->
lastBlock
();
...
...
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