[gnome-shell/wip/raresv/uiTweaks] search.js: work in progress



commit 3748e02828406af79cee5243fc0f4d4ad1a5ad4f
Author: raresvis <rares visalom gmail com>
Date:   Sat Jun 24 22:19:55 2017 +0300

    search.js: work in progress

 js/ui/search.js |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/search.js b/js/ui/search.js
index 790cd86..74e120b 100644
--- a/js/ui/search.js
+++ b/js/ui/search.js
@@ -104,11 +104,22 @@ const ListSearchResult = new Lang.Class({
                              y_align: St.Align.MIDDLE });
         this.actor.label_actor = title;
 
+        if (!this.metaInfo['description'])
+            log("no description in metainfo");
+
         if (this.metaInfo['description']) {
+            let searchTerms =
+                Shell.util_regex_escape(metaInfo.terms.join(' ')).split(" ");
+
+            let description_text = this.metaInfo['description'].replace(
+                                new RegExp(`(${searchTerms.join('|')})`, 'gi'),
+                                '<b>$1</b>');
+
             let description = new St.Label({
-                                style_class: 'list-search-result-description',
-                                text: this.metaInfo['description'] });
-            log('metainfo description: ' + this.metaInfo['description']);
+                                style_class: 'list-search-result-description' });
+            description.clutter_text.set_markup(description_text);
+
+            log('description_text: ' + description_text);
             details.add(description, { x_fill: false,
                                        y_fill: false,
                                        x_align: St.Align.START,
@@ -308,6 +319,9 @@ const ListSearchResults = new Lang.Class({
     },
 
     _createResultDisplay: function(meta) {
+        log("YEEEEEEP");
+        if (!meta['description'])
+            log("NO DESCRIPTION FFS");
         return this.parent(meta) || new ListSearchResult(this.provider, meta);
     },
 
@@ -482,7 +496,7 @@ const SearchResults = new Lang.Class({
         this._updateSearchProgress();
     },
 
-    _doSearch: function() {
+    _doSearch: function() {log('DO SEARCH'+this._isSubSearch);
         this._startingSearch = false;
 
         let previousResults = this._results;


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