aboutsummaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2022-02-07 17:06:04 +0100
committerfiaxh <git@lightrise.org>2022-02-07 22:17:21 +0100
commitee085e3e0dfd886090ad1e9e958847403c60e691 (patch)
tree88b26044e0c3ee5aa9472cad0e8168314a0f4a15 /main/src
parent29d1abccac205189d4ef1d5692493774b7af4bea (diff)
downloaddino-ee085e3e0dfd886090ad1e9e958847403c60e691.tar.gz
dino-ee085e3e0dfd886090ad1e9e958847403c60e691.zip
Fix quote styling occurring in the middle of a line
fixup 454c00a, 795af2d, 4e9e09a
Diffstat (limited to 'main/src')
-rw-r--r--main/src/ui/conversation_content_view/message_widget.vala4
-rw-r--r--main/src/ui/util/helper.vala26
2 files changed, 15 insertions, 15 deletions
diff --git a/main/src/ui/conversation_content_view/message_widget.vala b/main/src/ui/conversation_content_view/message_widget.vala
index 8868a8ce..e7bd1282 100644
--- a/main/src/ui/conversation_content_view/message_widget.vala
+++ b/main/src/ui/conversation_content_view/message_widget.vala
@@ -198,9 +198,9 @@ public class MessageItemWidget : SizeRequestBin {
}
if (conversation.type_ == Conversation.Type.GROUPCHAT) {
- markup_text = Util.parse_add_markup_theme(markup_text, conversation.nickname, true, true, Util.is_dark_theme(this), ref theme_dependent);
+ markup_text = Util.parse_add_markup_theme(markup_text, conversation.nickname, true, true, true, Util.is_dark_theme(this), ref theme_dependent);
} else {
- markup_text = Util.parse_add_markup_theme(markup_text, null, true, true, Util.is_dark_theme(this), ref theme_dependent);
+ markup_text = Util.parse_add_markup_theme(markup_text, null, true, true, true, Util.is_dark_theme(this), ref theme_dependent);
}
if (message.body.has_prefix("/me ")) {
diff --git a/main/src/ui/util/helper.vala b/main/src/ui/util/helper.vala
index 58abe810..51f0cc9c 100644
--- a/main/src/ui/util/helper.vala
+++ b/main/src/ui/util/helper.vala
@@ -239,14 +239,14 @@ public static Map<unichar, unichar> get_matching_chars() {
public static string parse_add_markup(string s_, string? highlight_word, bool parse_links, bool parse_text_markup) {
bool ignore_out_var = false;
- return parse_add_markup_theme(s_, highlight_word, parse_links, parse_text_markup, false, ref ignore_out_var);
+ return parse_add_markup_theme(s_, highlight_word, parse_links, parse_text_markup, parse_text_markup, false, ref ignore_out_var);
}
-public static string parse_add_markup_theme(string s_, string? highlight_word, bool parse_links, bool parse_text_markup, bool dark_theme, ref bool theme_dependent, bool already_escaped_ = false) {
+public static string parse_add_markup_theme(string s_, string? highlight_word, bool parse_links, bool parse_text_markup, bool parse_quotes, bool dark_theme, ref bool theme_dependent, bool already_escaped_ = false) {
string s = s_;
bool already_escaped = already_escaped_;
- if (parse_text_markup) {
+ if (parse_quotes) {
string gt = already_escaped ? "&gt;" : ">";
Regex quote_regex = new Regex("((?<=\n)" + gt + ".*(\n|$))|(^" + gt + ".*(\n|$))");
MatchInfo quote_match_info;
@@ -258,9 +258,9 @@ public static string parse_add_markup_theme(string s_, string? highlight_word, b
theme_dependent = true;
quote_match_info.fetch_pos(0, out start, out end);
- return parse_add_markup_theme(s[0:start], highlight_word, parse_links, parse_text_markup, dark_theme, ref theme_dependent, already_escaped) +
- @"<span color='$dim_color'>$gt " + parse_add_markup_theme(s[start + gt.length + 1:end], highlight_word, parse_links, parse_text_markup, dark_theme, ref theme_dependent, already_escaped) + "</span>" +
- parse_add_markup_theme(s[end:s.length], highlight_word, parse_links, parse_text_markup, dark_theme, ref theme_dependent, already_escaped);
+ return parse_add_markup_theme(s[0:start], highlight_word, parse_links, parse_text_markup, parse_quotes, dark_theme, ref theme_dependent, already_escaped) +
+ @"<span color='$dim_color'>$gt " + parse_add_markup_theme(s[start + gt.length + 1:end], highlight_word, parse_links, parse_text_markup, false, dark_theme, ref theme_dependent, already_escaped) + "</span>" +
+ parse_add_markup_theme(s[end:s.length], highlight_word, parse_links, parse_text_markup, parse_quotes, dark_theme, ref theme_dependent, already_escaped);
}
}
@@ -304,11 +304,11 @@ public static string parse_add_markup_theme(string s_, string? highlight_word, b
}
}
- return parse_add_markup_theme(s[0:start], highlight_word, parse_links, parse_text_markup, dark_theme, ref theme_dependent, already_escaped) +
+ return parse_add_markup_theme(s[0:start], highlight_word, parse_links, parse_text_markup, false, dark_theme, ref theme_dependent, already_escaped) +
"<a href=\"" + Markup.escape_text(link) + "\">" +
- parse_add_markup_theme(link, highlight_word, false, false, dark_theme, ref theme_dependent, already_escaped) +
+ parse_add_markup_theme(link, highlight_word, false, false, false, dark_theme, ref theme_dependent, already_escaped) +
"</a>" +
- parse_add_markup_theme(s[end:s.length], highlight_word, parse_links, parse_text_markup, dark_theme, ref theme_dependent, already_escaped);
+ parse_add_markup_theme(s[end:s.length], highlight_word, parse_links, parse_text_markup, false, dark_theme, ref theme_dependent, already_escaped);
}
match_info.next();
}
@@ -327,9 +327,9 @@ public static string parse_add_markup_theme(string s_, string? highlight_word, b
if (match_info.matches()) {
int start, end;
match_info.fetch_pos(0, out start, out end);
- return parse_add_markup_theme(s[0:start], highlight_word, parse_links, parse_text_markup, dark_theme, ref theme_dependent, already_escaped) +
+ return parse_add_markup_theme(s[0:start], highlight_word, parse_links, parse_text_markup, false, dark_theme, ref theme_dependent, already_escaped) +
"<b>" + s[start:end] + "</b>" +
- parse_add_markup_theme(s[end:s.length], highlight_word, parse_links, parse_text_markup, dark_theme, ref theme_dependent, already_escaped);
+ parse_add_markup_theme(s[end:s.length], highlight_word, parse_links, parse_text_markup, false, dark_theme, ref theme_dependent, already_escaped);
}
} catch (RegexError e) {
assert_not_reached();
@@ -349,11 +349,11 @@ public static string parse_add_markup_theme(string s_, string? highlight_word, b
if (match_info.matches()) {
int start, end;
match_info.fetch_pos(2, out start, out end);
- return parse_add_markup_theme(s[0:start-1], highlight_word, parse_links, parse_text_markup, dark_theme, ref theme_dependent, already_escaped) +
+ return parse_add_markup_theme(s[0:start-1], highlight_word, parse_links, parse_text_markup, false, dark_theme, ref theme_dependent, already_escaped) +
"<span color='#9E9E9E'>" + s[start-1:start] + "</span>" +
@"<$(convenience_tag[i])>" + s[start:end] + @"</$(convenience_tag[i])>" +
"<span color='#9E9E9E'>" + s[end:end+1] + "</span>" +
- parse_add_markup_theme(s[end+1:s.length], highlight_word, parse_links, parse_text_markup, dark_theme, ref theme_dependent, already_escaped);
+ parse_add_markup_theme(s[end+1:s.length], highlight_word, parse_links, parse_text_markup, false, dark_theme, ref theme_dependent, already_escaped);
}
} catch (RegexError e) {
assert_not_reached();