Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
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
Tobias Hunger
qt-creator
Commits
9d8fc287
Commit
9d8fc287
authored
16 years ago
by
hjk
Browse files
Options
Downloads
Patches
Plain Diff
Fixes: fakevim: show column/line information in standalone application
parent
ac8ed036
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/plugins/fakevim/fakevimhandler.cpp
+15
-14
15 additions, 14 deletions
src/plugins/fakevim/fakevimhandler.cpp
tests/manual/fakevim/main.cpp
+30
-7
30 additions, 7 deletions
tests/manual/fakevim/main.cpp
with
45 additions
and
21 deletions
src/plugins/fakevim/fakevimhandler.cpp
+
15
−
14
View file @
9d8fc287
...
...
@@ -893,6 +893,13 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
moveDown
(
qMax
(
count
()
-
1
,
0
));
moveRight
(
rightDist
());
finishMovement
();
}
else
if
(
key
==
control
(
'd'
))
{
int
sline
=
cursorLineOnScreen
();
// FIXME: this should use the "scroll" option, and "count"
moveDown
(
linesOnScreen
()
/
2
);
moveToFirstNonBlankOnLine
();
scrollToLineInDocument
(
cursorLineInDocument
()
-
sline
);
finishMovement
();
}
else
if
(
key
==
'e'
)
{
m_moveType
=
MoveInclusive
;
moveToWordBoundary
(
false
,
true
);
...
...
@@ -1068,6 +1075,13 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
// FIXME: this is non-vim, but as Ctrl-R is taken globally
// we have a substitute here
redo
();
}
else
if
(
key
==
control
(
'u'
))
{
int
sline
=
cursorLineOnScreen
();
// FIXME: this should use the "scroll" option, and "count"
moveUp
(
linesOnScreen
()
/
2
);
moveToFirstNonBlankOnLine
();
scrollToLineInDocument
(
cursorLineInDocument
()
-
sline
);
finishMovement
();
}
else
if
(
key
==
'v'
)
{
enterVisualMode
(
VisualCharMode
);
}
else
if
(
key
==
'V'
)
{
...
...
@@ -1137,20 +1151,6 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
}
recordInsertText
(
str
);
recordEndGroup
();
}
else
if
(
key
==
control
(
'd'
))
{
int
sline
=
cursorLineOnScreen
();
// FIXME: this should use the "scroll" option, and "count"
moveDown
(
linesOnScreen
()
/
2
);
moveToFirstNonBlankOnLine
();
scrollToLineInDocument
(
cursorLineInDocument
()
-
sline
);
finishMovement
();
}
else
if
(
key
==
control
(
'u'
))
{
int
sline
=
cursorLineOnScreen
();
// FIXME: this should use the "scroll" option, and "count"
moveUp
(
linesOnScreen
()
/
2
);
moveToFirstNonBlankOnLine
();
scrollToLineInDocument
(
cursorLineInDocument
()
-
sline
);
finishMovement
();
}
else
if
(
key
==
Key_PageDown
||
key
==
control
(
'f'
))
{
moveDown
(
count
()
*
(
linesOnScreen
()
-
2
));
finishMovement
();
...
...
@@ -1588,6 +1588,7 @@ void FakeVimHandler::Private::search(const QString &needle0, bool forward)
if
(
EDITOR
(
find
(
needle
,
flags
)))
{
m_tc
=
EDITOR
(
textCursor
());
m_tc
.
setPosition
(
m_tc
.
anchor
());
// making this unconditional feels better, but is not "vim like"
if
(
oldLine
!=
cursorLineInDocument
()
-
cursorLineOnScreen
())
scrollToLineInDocument
(
cursorLineInDocument
()
-
linesOnScreen
()
/
2
);
return
;
...
...
This diff is collapsed.
Click to expand it.
tests/manual/fakevim/main.cpp
+
30
−
7
View file @
9d8fc287
...
...
@@ -17,8 +17,8 @@ class Proxy : public QObject
Q_OBJECT
public:
Proxy
(
QWidget
*
widget
,
QObject
*
parent
=
0
)
:
QObject
(
parent
),
m_widget
(
widget
)
Proxy
(
QWidget
*
widget
,
QMainWindow
*
mw
,
QObject
*
parent
=
0
)
:
QObject
(
parent
),
m_widget
(
widget
)
,
m_mainWindow
(
mw
)
{}
public
slots
:
...
...
@@ -30,13 +30,35 @@ public slots:
ed
->
setExtraSelections
(
s
);
}
void
changeStatusData
(
const
QString
&
info
)
{
m_statusData
=
info
;
updateStatusBar
();
}
void
changeStatusMessage
(
const
QString
&
info
)
{
m_statusMessage
=
info
;
updateStatusBar
();
}
void
changeExtraInformation
(
const
QString
&
info
)
{
QMessageBox
::
information
(
m_widget
,
"Information"
,
info
);
}
void
updateStatusBar
()
{
int
slack
=
80
-
m_statusMessage
.
size
()
-
m_statusData
.
size
();
QString
msg
=
m_statusMessage
+
QString
(
slack
,
QChar
(
' '
))
+
m_statusData
;
m_mainWindow
->
statusBar
()
->
showMessage
(
msg
);
}
private
:
QWidget
*
m_widget
;
QMainWindow
*
m_mainWindow
;
QString
m_statusMessage
;
QString
m_statusData
;
};
int
main
(
int
argc
,
char
*
argv
[])
...
...
@@ -64,11 +86,11 @@ int main(int argc, char *argv[])
//widget->resize(450, 350);
widget
->
setFocus
();
Proxy
proxy
(
widget
);
QMainWindow
mw
;
Proxy
proxy
(
widget
,
&
mw
);
FakeVimHandler
handler
(
widget
,
0
);
QMainWindow
mw
;
mw
.
setWindowTitle
(
"Fakevim ("
+
title
+
")"
);
mw
.
setCentralWidget
(
widget
);
mw
.
resize
(
600
,
650
);
...
...
@@ -85,15 +107,16 @@ int main(int argc, char *argv[])
mw
.
statusBar
()
->
setFont
(
font
);
QObject
::
connect
(
&
handler
,
SIGNAL
(
commandBufferChanged
(
QString
)),
mw
.
statusBar
(),
SLOT
(
show
Message
(
QString
)));
&
proxy
,
SLOT
(
changeStatus
Message
(
QString
)));
QObject
::
connect
(
&
handler
,
SIGNAL
(
quitRequested
()),
&
app
,
SLOT
(
quit
()));
QObject
::
connect
(
&
handler
,
SIGNAL
(
selectionChanged
(
QList
<
QTextEdit
::
ExtraSelection
>
)),
&
proxy
,
SLOT
(
changeSelection
(
QList
<
QTextEdit
::
ExtraSelection
>
)));
QObject
::
connect
(
&
handler
,
SIGNAL
(
extraInformationChanged
(
QString
)),
QObject
::
connect
(
&
handler
,
SIGNAL
(
extraInformationChanged
(
QString
)),
&
proxy
,
SLOT
(
changeExtraInformation
(
QString
)));
QObject
::
connect
(
&
handler
,
SIGNAL
(
statusDataChanged
(
QString
)),
&
proxy
,
SLOT
(
changeStatusData
(
QString
)));
handler
.
setupWidget
();
if
(
args
.
size
()
>=
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