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
Network
Konversation
Commits
ab767e1f
Commit
ab767e1f
authored
Dec 16, 2021
by
Friedrich W. H. Kossebau
Browse files
Support and use modern code for Strikethrough formatting
parent
82cf2e1f
Pipeline
#115703
passed with stage
in 1 minute and 18 seconds
Changes
3
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
src/common.cpp
View file @
ab767e1f
...
...
@@ -99,7 +99,7 @@ namespace Konversation
line
.
replace
(
QStringLiteral
(
"%G"
),
QStringLiteral
(
"
\x07
"
));
// replace %G with ASCII BEL 0x07
line
.
replace
(
QStringLiteral
(
"%I"
),
QStringLiteral
(
"
\x1d
"
));
// replace %I with italics char
line
.
replace
(
QStringLiteral
(
"%O"
),
QStringLiteral
(
"
\x0f
"
));
// replace %O with reset to default char
line
.
replace
(
QStringLiteral
(
"%S"
),
QStringLiteral
(
"
\x1
3
"
));
// replace %S with strikethru char
line
.
replace
(
QStringLiteral
(
"%S"
),
QStringLiteral
(
"
\x1
e
"
));
// replace %S with strikethru char
// line.replace(QRegExp("%?"),"\x15");
line
.
replace
(
QStringLiteral
(
"%R"
),
QStringLiteral
(
"
\x16
"
));
// replace %R with reverse char
line
.
replace
(
QStringLiteral
(
"%U"
),
QStringLiteral
(
"
\x1f
"
));
// replace %U with underline char
...
...
@@ -117,7 +117,10 @@ namespace Konversation
line
.
replace
(
QLatin1Char
(
'\x07'
),
QStringLiteral
(
"%G"
));
// replace ASCII BEL 0x07 with %G
line
.
replace
(
QLatin1Char
(
'\x1d'
),
QStringLiteral
(
"%I"
));
// replace italics char with %I
line
.
replace
(
QLatin1Char
(
'\x0f'
),
QStringLiteral
(
"%O"
));
// replace reset to default char with %O
// historic code
line
.
replace
(
QLatin1Char
(
'\x13'
),
QStringLiteral
(
"%S"
));
// replace strikethru char with %S
// modern
line
.
replace
(
QLatin1Char
(
'\x1e'
),
QStringLiteral
(
"%S"
));
// replace strikethru char with %S
line
.
replace
(
QLatin1Char
(
'\x16'
),
QStringLiteral
(
"%R"
));
// replace reverse char with %R
// underline char send by kvirc
line
.
replace
(
QLatin1Char
(
'\x1f'
),
QStringLiteral
(
"%U"
));
// replace underline char with %U
...
...
src/common.h
View file @
ab767e1f
...
...
@@ -19,7 +19,7 @@ namespace Konversation
{
static
QRegularExpression
ircMarkupsRegExp
(
QStringLiteral
(
"[
\\
o{0000}-
\\
o{0037}]"
));
static
QRegExp
colorRegExp
(
QStringLiteral
(
"((
\003
([0-9]|0[0-9]|1[0-5])(,([0-9]|0[0-9]|1[0-5])|)|
\017
)|
\x02
|
\x03
|
\x09
|
\x13
|
\x15
|
\x16
|
\x1d
|
\x1f
)"
));
static
QRegExp
colorRegExp
(
QStringLiteral
(
"((
\003
([0-9]|0[0-9]|1[0-5])(,([0-9]|0[0-9]|1[0-5])|)|
\017
)|
\x02
|
\x03
|
\x09
|
\x13
|
\x15
|
\x16
|
\x1d
|
\
x1e
|
\
x1f
)"
));
static
QRegularExpression
urlPattern
(
QStringLiteral
(
"
\\
b((?:(?:([a-z][
\\
w
\\
.-]+:/{1,3})|www
\\
d{0,3}[.]|[a-z0-9.
\\
-]+[.][a-z]{2,4}/)(?:[^
\\
s()<>]+|
\\
(([^
\\
s()<>]+|(
\\
([^
\\
s()<>]+
\\
)))*
\\
))+(?:
\\
(([^
\\
s()<>]+|(
\\
([^
\\
s()<>]+
\\
)))*
\\
)|
\\
}
\\
]|[^
\\
s`!()
\\
[
\\
]{};:'
\"
.,<>?%1%2%3%4%5%6])|[a-z0-9.
\\
-+_]+@[a-z0-9.
\\
-]+[.][a-z]{1,5}[^
\\
s/`!()
\\
[
\\
]{};:'
\"
.,<>?%1%2%3%4%5%6]))"
).
arg
(
QChar
(
0x00AB
)).
arg
(
QChar
(
0x00BB
)).
arg
(
QChar
(
0x201C
)).
arg
(
QChar
(
0x201D
)).
arg
(
QChar
(
0x2018
)).
arg
(
QChar
(
0x2019
)));
...
...
src/viewer/ircview.cpp
View file @
ab767e1f
...
...
@@ -1425,7 +1425,8 @@ QString IRCView::ircTextToHtml(const QString& text, bool parseURL, const QString
pos
+=
offset
-
1
;
linkOffset
+=
offset
-
1
;
break
;
case
'\x13'
:
//strikethru
case
'\x13'
:
//historic strikethru
case
'\x1e'
:
//modern strikethru
offset
=
defaultHtmlReplace
(
htmlText
,
&
data
,
pos
,
QStringLiteral
(
"s"
));
pos
+=
offset
-
1
;
linkOffset
+=
offset
-
1
;
...
...
@@ -1800,7 +1801,8 @@ QString IRCView::removeDuplicateCodes(const QString& codes, TextHtmlData* data,
defaultRemoveDuplicateHandling
(
data
,
QStringLiteral
(
"u"
));
++
pos
;
break
;
case
'\x13'
:
//strikethru
case
'\x13'
:
//historic strikethru
case
'\x1e'
:
//modern strikethru
defaultRemoveDuplicateHandling
(
data
,
QStringLiteral
(
"s"
));
++
pos
;
break
;
...
...
Write
Preview
Markdown
is supported
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