[polari/wip/fmuellner/combined-gsoc: 10/103] Improved highlighting.



commit 0ec00b1471a95014b96e0e1b3d7e472354c8a56e
Author: Kunaal Jain <kunaalus gmail com>
Date:   Sun Jun 12 19:03:35 2016 +0530

    Improved highlighting.

 src/mainWindow.js |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/mainWindow.js b/src/mainWindow.js
index f5aa2af..5f9ba0c 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -262,16 +262,17 @@ const MainWindow = new Lang.Class({
     _Log: function(events) {
         log(events);
         let widgetMap = {};
+        let markup_message = '';
         for (let i = 0; i < events.length; i++) {
             let message = events[i].mms;
             let uid = events[i].id;
-
+            let index = 0;
             let row = this._widgetMap[uid];
             for (let j = 0; j < this._keywords.length; j++) {
-                log(this._keywords[j]);
-                print(message.indexOf(this._keywords[j]));
-                message = message.replace(this._keywords[j],"<span 
font_weight='bold'>"+this._keywords[j]+"</span>");
-                print(message);
+                // log(this._keywords[j]);
+                index = message.indexOf(this._keywords[j]);
+                message = message.replace( new RegExp( "(" + this._keywords[j] + ")" , 'gi' ),"<span 
font_weight='bold'>$1</span>");
+                // print(message);
             }
 
             if (row) {
@@ -292,6 +293,7 @@ const MainWindow = new Lang.Class({
                 row.uid = events[i].id;
                 widgetMap[uid] = row;
             }
+            widgetMap[uid].get_children()[0].label = message;
         }
 
         this._widgetMap = widgetMap;
@@ -300,6 +302,7 @@ const MainWindow = new Lang.Class({
 
         for (let i = 0; i < events.length; i++) {
             let row = this._widgetMap[events[i].id];
+            // row.get_children()[0].label = markup_message;
             this._results.add(row);
         }
     },


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