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
Marco Bubke
flatpak-qt-creator
Commits
d90dc9e3
Commit
d90dc9e3
authored
Jan 06, 2009
by
hjk
Browse files
work on command line display
parent
69475d70
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/plugins/fakevim/handler.cpp
View file @
d90dc9e3
...
...
@@ -343,8 +343,7 @@ void FakeVimHandler::Private::updateMiniBuffer()
msg
=
"-- INSERT --"
;
}
else
{
msg
=
QChar
(
m_commandCode
?
m_commandCode
:
' '
);
for
(
int
i
=
0
;
i
!=
m_commandBuffer
.
size
();
++
i
)
{
QChar
c
=
m_commandBuffer
.
at
(
i
);
foreach
(
QChar
c
,
m_commandBuffer
)
{
if
(
c
.
unicode
()
<
32
)
{
msg
+=
'^'
;
msg
+=
QChar
(
c
.
unicode
()
+
64
);
...
...
@@ -352,16 +351,24 @@ void FakeVimHandler::Private::updateMiniBuffer()
msg
+=
c
;
}
}
msg
+=
" "
;
}
int
L
=
linesInDocument
();
int
linesInDoc
=
linesInDocument
();
int
l
=
cursorLineInDocument
();
int
w
=
columnsOnScreen
();
if
(
msg
.
size
()
>
w
-
20
)
msg
=
">"
+
msg
.
right
(
w
-
19
);
msg
+=
QString
(
w
,
' '
);
msg
=
msg
.
left
(
w
-
20
);
msg
=
msg
.
left
(
w
-
19
);
QString
pos
=
tr
(
"%1,%2"
).
arg
(
l
+
1
).
arg
(
cursorColumnInDocument
()
+
1
);
msg
+=
tr
(
"%1"
).
arg
(
pos
,
-
1
2
);
msg
+=
tr
(
"%1"
).
arg
(
pos
,
-
1
0
);
// FIXME: physical "-" logical
msg
+=
L
?
tr
(
"%1%%"
).
arg
(
l
*
100
/
L
,
4
)
:
QString
(
"All"
);
if
(
linesInDoc
!=
0
)
{
msg
+=
tr
(
"%1"
).
arg
(
l
*
100
/
linesInDoc
,
4
);
msg
+=
"%"
;
}
else
{
msg
+=
"All"
;
}
emit
q
->
commandBufferChanged
(
msg
);
}
...
...
@@ -895,9 +902,10 @@ void FakeVimHandler::Private::handleCommand(const QString &cmd0)
file
.
close
();
file
.
open
(
QIODevice
::
ReadWrite
);
QByteArray
ba
=
file
.
readAll
();
showMessage
(
tr
(
"
\"
%1
\"
%2 %3L, %4C written"
)
m_commandBuffer
=
QString
(
"
\"
%1
\"
%2 %3L, %4C written"
)
.
arg
(
fileName
).
arg
(
exists
?
" "
:
" [New] "
)
.
arg
(
ba
.
count
(
'\n'
)).
arg
(
ba
.
size
()));
.
arg
(
ba
.
count
(
'\n'
)).
arg
(
ba
.
size
());
updateMiniBuffer
();
}
}
else
if
(
cmd
.
startsWith
(
"r "
))
{
// :r
m_currentFileName
=
cmd
.
mid
(
2
);
...
...
Write
Preview
Supports
Markdown
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