diff options
author | fiaxh <git@lightrise.org> | 2022-01-11 22:48:12 +0100 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2022-01-11 23:12:46 +0100 |
commit | 4e9e09a648a6bec75e0baeb934dbe5dcef0108b6 (patch) | |
tree | 85d0e51c2bb62be072f123c0adafbffb073f157a /main/src | |
parent | fa6d49e3bf664e7862548223df9b0882c11eefb1 (diff) | |
download | dino-4e9e09a648a6bec75e0baeb934dbe5dcef0108b6.tar.gz dino-4e9e09a648a6bec75e0baeb934dbe5dcef0108b6.zip |
Apply message quote style prior to bold/italic style
Quotes apply to the whole line. Having a bold part in that line results in the quote styling only extending up to the bold part.
Diffstat (limited to 'main/src')
-rw-r--r-- | main/src/ui/util/helper.vala | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/main/src/ui/util/helper.vala b/main/src/ui/util/helper.vala index c1c32048..f533ffad 100644 --- a/main/src/ui/util/helper.vala +++ b/main/src/ui/util/helper.vala @@ -312,6 +312,18 @@ public static string parse_add_markup(string s_, string? highlight_word, bool pa } if (parse_text_markup) { + Regex quote_regex = new Regex("((?<=\n)>.*(\n|$))|(^>.*(\n|$))"); + MatchInfo quote_match_info; + quote_regex.match(s.down(), 0, out quote_match_info); + if (quote_match_info.matches()) { + int start, end; + + quote_match_info.fetch_pos(0, out start, out end); + return parse_add_markup(s[0:start], highlight_word, parse_links, parse_text_markup, already_escaped) + + "<span fgalpha='70%'>" + s[start:end] + "</span>" + + parse_add_markup(s[end:s.length], highlight_word, parse_links, parse_text_markup, already_escaped); + } + string[] markup_string = new string[]{"`", "_", "*", "~"}; string[] convenience_tag = new string[]{"tt", "i", "b", "s"}; @@ -334,19 +346,6 @@ public static string parse_add_markup(string s_, string? highlight_word, bool pa assert_not_reached(); } } - - Regex regex = new Regex("((?<=\n)>.*(\n|$))|(^>.*(\n|$))"); - MatchInfo match_info; - regex.match(s.down(), 0, out match_info); - - if (match_info.matches()) { - int start, end; - - match_info.fetch_pos(0, out start, out end); - return parse_add_markup(s[0:start], highlight_word, parse_links, parse_text_markup, already_escaped) + - "<span fgalpha='70%'>" + s[start:end] + "</span>" + - parse_add_markup(s[end:s.length], highlight_word, parse_links, parse_text_markup, already_escaped); - } } return s; |