diff options
author | fiaxh <git@lightrise.org> | 2019-03-14 17:38:48 +0100 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2019-03-14 17:39:31 +0100 |
commit | 952ac9548402744ac9b13917255b9e461a96abe5 (patch) | |
tree | 0aa4c1c87b0da5961450cf024b1684e264d13c09 /main/src/ui | |
parent | fb504308d03e078422422b57323f89ae86dac466 (diff) | |
download | dino-952ac9548402744ac9b13917255b9e461a96abe5.tar.gz dino-952ac9548402744ac9b13917255b9e461a96abe5.zip |
Use regex literals, fixes some compiler warnings
Diffstat (limited to 'main/src/ui')
-rw-r--r-- | main/src/ui/conversation_selector/conversation_row.vala | 2 | ||||
-rw-r--r-- | main/src/ui/unified_window.vala | 2 | ||||
-rw-r--r-- | main/src/ui/util/helper.vala | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/main/src/ui/conversation_selector/conversation_row.vala b/main/src/ui/conversation_selector/conversation_row.vala index 2d41d044..0d0db23a 100644 --- a/main/src/ui/conversation_selector/conversation_row.vala +++ b/main/src/ui/conversation_selector/conversation_row.vala @@ -136,7 +136,7 @@ public class ConversationRow : ListBoxRow { nick_label.label = last_message.direction == Message.DIRECTION_SENT ? _("Me") + ": " : ""; } - message_label.label = Markup.escape_text((new Regex("\\s+")).replace_literal(last_message.body, -1, 0, " ")); + message_label.label = Markup.escape_text((/\s+/).replace_literal(last_message.body, -1, 0, " ")); break; case FileItem.TYPE: FileItem file_item = last_content_item as FileItem; diff --git a/main/src/ui/unified_window.vala b/main/src/ui/unified_window.vala index 44107fb3..aa1aac60 100644 --- a/main/src/ui/unified_window.vala +++ b/main/src/ui/unified_window.vala @@ -28,7 +28,7 @@ public class UnifiedWindow : Gtk.Window { return Util.use_csd() ? conversation_titlebar_csd.subtitle : conversation_titlebar.subtitle; } set { - string? new_subtitle = value == null ? null : (new Regex("\\s+")).replace_literal(value, -1, 0, " "); + string? new_subtitle = value == null ? null : (/\s+/).replace_literal(value, -1, 0, " "); if (Util.use_csd()) { conversation_titlebar_csd.subtitle = new_subtitle; } else { diff --git a/main/src/ui/util/helper.vala b/main/src/ui/util/helper.vala index de05d753..449936fc 100644 --- a/main/src/ui/util/helper.vala +++ b/main/src/ui/util/helper.vala @@ -169,7 +169,7 @@ public static string parse_add_markup(string s_, string? highlight_word, bool pa bool already_escaped = already_escaped_; if (parse_links) { - Regex url_regex = new Regex("""(?i)\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))"""); + Regex url_regex = /(?i)\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/; MatchInfo match_info; url_regex.match(s.down(), 0, out match_info); if (match_info.matches()) { |