[smuxi: 69/111] Frontend-GNOME: re-use regex instance in MessageTextView



commit 5ca1c0a50432ee58432b787df23c9d3709c98f43
Author: Mirco Bauer <meebey meebey net>
Date:   Sun Jan 12 08:08:46 2014 +0100

    Frontend-GNOME: re-use regex instance in MessageTextView

 src/Frontend-GNOME/Views/MessageTextView.cs |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/Frontend-GNOME/Views/MessageTextView.cs b/src/Frontend-GNOME/Views/MessageTextView.cs
index 40d2c83..6ccf7c0 100644
--- a/src/Frontend-GNOME/Views/MessageTextView.cs
+++ b/src/Frontend-GNOME/Views/MessageTextView.cs
@@ -38,6 +38,7 @@ namespace Smuxi.Frontend.Gnome
 #endif        
         private static readonly Gdk.Cursor _NormalCursor = new Gdk.Cursor(Gdk.CursorType.Xterm);
         private static readonly Gdk.Cursor _LinkCursor = new Gdk.Cursor(Gdk.CursorType.Hand2);
+        static readonly Regex NickRegex = new Regex("^(<([^ ]+)> )");
         static bool IsGtk2_17 { get; set; }
         private Gtk.TextTagTable _MessageTextTagTable;
         private MessageModel _LastMessage;
@@ -813,7 +814,7 @@ namespace Smuxi.Frontend.Gnome
             // HACK: try to obtain the nickname from the message
             // TODO: extend MessageModel with Origin property
             var msgText = msg.ToString();
-            var nickMatch = Regex.Match(msgText, "^(<([^ ]+)> )");
+            var nickMatch = NickRegex.Match(msgText);
             if (nickMatch.Success) {
                 // HACK: the nick can be bold
                 if (msg.MessageParts.Count >= 3) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]