[polari/wip/fmuellner/combined-gsoc: 23/136] another way to ellipsize at both end



commit 019bfd94910622f770e37dc748947f8f216853e6
Author: Kunaal Jain <kunaalus gmail com>
Date:   Mon Jun 13 08:56:47 2016 +0530

    another way to ellipsize at both end

 src/mainWindow.js |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 03ad86f..a8ce5e4 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -266,11 +266,11 @@ const MainWindow = new Lang.Class({
         for (let i = 0; i < events.length; i++) {
             let message = events[i].mms;
             let uid = events[i].id;
-            let index = message.indexOf(this._keywords[0] - 5);
+            let index = message.indexOf(this._keywords[0]);
             let row = this._widgetMap[uid];
             for (let j = 0; j < this._keywords.length; j++) {
                 // log(this._keywords[j]);
-                index = message.indexOf(this._keywords[j]);
+                index = Math.min(index, message.indexOf(this._keywords[j]));
                 message = message.replace( new RegExp( "(" + this._keywords[j] + ")" , 'gi' ),"<span 
font_weight='bold'>$1</span>");
                 // print(message);
             }
@@ -293,7 +293,7 @@ const MainWindow = new Lang.Class({
                 row.uid = events[i].id;
                 widgetMap[uid] = row;
             }
-            widgetMap[uid].get_children()[0].label = message.substring(index - 2);
+            widgetMap[uid].get_children()[0].label = "..." + message.substring(index - 6);
         }
 
         this._widgetMap = widgetMap;


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