[banshee] [ListView] Optimised ColumnCellText rendering



commit 598242592d9cc59404963f716480fc03fcea6ead
Author: Alexander Kojevnikov <alexander kojevnikov com>
Date:   Fri Sep 11 10:43:55 2009 +1000

    [ListView] Optimised ColumnCellText rendering

 .../Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs     |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs
index f44cc28..b13d06c 100644
--- a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs
+++ b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs
@@ -105,10 +105,13 @@ namespace Hyena.Data.Gui
             is_ellipsized = context.Layout.IsEllipsized;
         }
 
+        private static char[] lfcr = new char[] {'\n', '\r'};
         private void UpdateLayout (Pango.Layout layout, string text)
         {
             string final_text = GetFormattedText (text);
-            final_text = final_text.Replace ("\r\n", "\x20").Replace ("\n", "\x20").Replace ("\r", "\x20");
+            if (final_text.IndexOfAny (lfcr) >= 0) {
+                final_text = final_text.Replace ("\r\n", "\x20").Replace ('\n', '\x20').Replace ('\r', '\x20');
+            }
             if (use_markup) {
                 layout.SetMarkup (final_text);
             } else {



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