Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nheko
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Nheko Reborn
nheko
Commits
e7f20eea
Commit
e7f20eea
authored
4 years ago
by
LordMZTE
Browse files
Options
Downloads
Patches
Plain Diff
use QString as buf in rainbowifyer
parent
4e6150f2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#936
failed
4 years ago
Stage: build
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Utils.cpp
+4
-5
4 additions, 5 deletions
src/Utils.cpp
with
4 additions
and
5 deletions
src/Utils.cpp
+
4
−
5
View file @
e7f20eea
...
...
@@ -510,7 +510,7 @@ utils::markdownToHtml(const QString &text, bool rainbowify)
// get text in current node
QString
nodeText
(
cmark_node_get_literal
(
cur
));
// create buffer to append rainbow text to
std
::
s
tring
buf
;
QS
tring
buf
;
int
boundaryStart
=
0
;
int
boundaryEnd
=
0
;
// use QTextBoundaryFinder to iterate ofer graphemes
...
...
@@ -523,7 +523,7 @@ utils::markdownToHtml(const QString &text, bool rainbowify)
boundaryStart
=
boundaryEnd
;
// Don't rainbowify whitespaces
if
(
curChar
.
trimmed
().
isEmpty
())
{
buf
.
append
(
curChar
.
toString
()
.
toStdString
()
);
buf
.
append
(
curChar
.
toString
());
continue
;
}
...
...
@@ -534,8 +534,7 @@ utils::markdownToHtml(const QString &text, bool rainbowify)
// create HTML element for current char
auto
curCharColored
=
QString
(
"<font color=
\"
%0
\"
>%1</font>"
)
.
arg
(
colorString
)
.
arg
(
curChar
)
.
toStdString
();
.
arg
(
curChar
);
// append colored HTML element to buffer
buf
.
append
(
curCharColored
);
...
...
@@ -545,7 +544,7 @@ utils::markdownToHtml(const QString &text, bool rainbowify)
// create HTML_INLINE node to prevent HTML from being escaped
auto
htmlNode
=
cmark_node_new
(
CMARK_NODE_HTML_INLINE
);
// set content of HTML node to buffer contents
cmark_node_set_literal
(
htmlNode
,
buf
.
c_str
());
cmark_node_set_literal
(
htmlNode
,
buf
.
toUtf8
().
data
());
// replace current node with HTML node
cmark_node_replace
(
cur
,
htmlNode
);
// free memory of old node
...
...
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