Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qbar
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
Jens Nolte
qbar
Commits
6c04d58a
Verified
Commit
6c04d58a
authored
1 year ago
by
Legy (Beini)
Browse files
Options
Downloads
Patches
Plain Diff
Improve compatibility with some pango parsers by always escaping complex chars
parent
e2969310
No related branches found
Branches containing commit
No related tags found
1 merge request
!9
Ags ready
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
qbar/src/QBar/BlockOutput.hs
+25
-1
25 additions, 1 deletion
qbar/src/QBar/BlockOutput.hs
with
25 additions
and
1 deletion
qbar/src/QBar/BlockOutput.hs
+
25
−
1
View file @
6c04d58a
...
...
@@ -45,6 +45,7 @@ import QBar.Prelude
import
Control.Lens
import
Data.Aeson
import
Data.Char
import
Data.Int
(
Int64
)
import
Data.Text.Lazy
qualified
as
T
import
GHC.Generics
...
...
@@ -209,8 +210,31 @@ printedLength (BlockText b) = sum . map segmentLength $ b
mkText
::
Bool
->
Importance
->
T
.
Text
->
BlockText
mkText
active
importance
segmentText
=
BlockText
[
BlockTextSegment
{
segmentText
=
pangoFriendly
segmentText
,
active
,
importance
}]
where
toHex
::
Int
->
T
.
Text
toHex
1
=
"1"
toHex
2
=
"2"
toHex
3
=
"3"
toHex
4
=
"4"
toHex
5
=
"5"
toHex
6
=
"6"
toHex
7
=
"7"
toHex
8
=
"8"
toHex
9
=
"9"
toHex
10
=
"A"
toHex
11
=
"B"
toHex
12
=
"C"
toHex
13
=
"D"
toHex
14
=
"E"
toHex
15
=
"F"
toHex
x
|
x
<=
0
=
"0"
|
otherwise
=
toHex
(
div
x
16
)
<>
toHex
(
mod
x
16
)
pangoFriendlyIcon
::
Char
->
T
.
Text
pangoFriendlyIcon
x
|
isAlphaNum
x
||
isAscii
x
=
T
.
singleton
x
|
otherwise
=
"&#x"
<>
toHex
(
ord
x
)
<>
";"
pangoFriendly
::
T
.
Text
->
T
.
Text
pangoFriendly
=
T
.
replace
"<"
"<"
.
T
.
replace
">"
">"
.
T
.
replace
"&"
"&"
pangoFriendly
=
T
.
concatMap
pangoFriendlyIcon
.
T
.
replace
"<"
"<"
.
T
.
replace
">"
">"
.
T
.
replace
"&"
"&"
activeImportantText
::
Importance
->
T
.
Text
->
BlockText
activeImportantText
=
mkText
True
...
...
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