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
Utilities
Kate
Commits
f57d63f2
Commit
f57d63f2
authored
Aug 06, 2022
by
Pablo Rauzy
Committed by
Christoph Cullmann
Aug 14, 2022
Browse files
KStringHandler::rsqueeze rather than reimplementing it
parent
b1335fe7
Changes
2
Hide whitespace changes
Inline
Side-by-side
addons/keyboardmacros/keyboardmacrosplugin.cpp
View file @
f57d63f2
...
...
@@ -34,6 +34,7 @@
#include
<KActionMenu>
#include
<KLocalizedString>
#include
<KPluginFactory>
#include
<KStringHandler>
#include
<KXMLGUIFactory>
#include
<KTextEditor/Application>
...
...
@@ -539,7 +540,9 @@ KeyboardMacrosPluginView::~KeyboardMacrosPluginView()
void
KeyboardMacrosPluginView
::
addNamedMacro
(
const
QString
&
name
,
const
Macro
&
macro
)
{
QAction
*
action
;
QString
definition
=
name
+
QStringLiteral
(
": "
)
+
macro
.
toString
();
QString
label
=
KStringHandler
::
rsqueeze
(
name
+
QStringLiteral
(
": "
)
+
macro
.
toString
(),
50
)
// avoid unwanted accelerators
.
replace
(
QRegularExpression
(
QStringLiteral
(
"&(?!&)"
)),
QStringLiteral
(
"&&"
));
// add load action
action
=
actionCollection
()
->
addAction
(
QStringLiteral
(
"keyboardmacros_named_load_"
)
+
name
);
...
...
addons/keyboardmacros/macro.h
View file @
f57d63f2
...
...
@@ -10,6 +10,7 @@
#include
<QJsonArray>
#include
<QJsonValue>
#include
<QList>
#include
<QRegularExpression>
#include
<QtGlobal>
#include
"keycombination.h"
...
...
@@ -50,12 +51,7 @@ public:
str
+=
QStringLiteral
(
" "
)
+
kc
.
toString
()
+
QStringLiteral
(
" "
);
}
}
int
len
=
str
.
size
();
str
=
str
.
trimmed
().
replace
(
QStringLiteral
(
" "
),
QStringLiteral
(
" "
)).
left
(
32
);
if
(
len
>
str
.
size
())
{
str
+=
QStringLiteral
(
"..."
);
}
return
str
;
return
str
.
trimmed
().
replace
(
QRegularExpression
(
QStringLiteral
(
"
\\
s+"
)),
QStringLiteral
(
" "
));
};
};
...
...
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