[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kate] addons/search: Fix goToPreviousMatch when file item above is not expanded.
From:       Kåre Särs <kare.sars () iki ! fi>
Date:       2016-07-03 11:39:58
Message-ID: E1bJfkk-0003C3-Ca () code ! kde ! org
[Download RAW message or body]

Git commit feaa54b671bc388b489835b89f55a5d1ccfbd184 by Kåre Särs.
Committed on 02/07/2016 at 20:39.
Pushed by sars into branch 'master'.

Fix goToPreviousMatch when file item above is not expanded.

M  +12   -0    addons/search/plugin_search.cpp

http://commits.kde.org/kate/feaa54b671bc388b489835b89f55a5d1ccfbd184

diff --git a/addons/search/plugin_search.cpp b/addons/search/plugin_search.cpp
index 94614f1..edd6062 100644
--- a/addons/search/plugin_search.cpp
+++ b/addons/search/plugin_search.cpp
@@ -1583,9 +1583,21 @@ void KatePluginSearchView::goToPreviousMatch()
         }
     }
 
+    QTreeWidgetItem *startChild = curr;
+
     // go to the item above. (curr == null is not a problem)
     curr = res->tree->itemAbove(curr);
 
+    // expand the items above if needed
+    if (curr && curr->data(0, ReplaceMatches::ColumnRole).toString().isEmpty()) {
+        res->tree->expandItem(curr);  // probably this file item
+        curr = res->tree->itemAbove(curr);
+        if (curr && curr->data(0, ReplaceMatches::ColumnRole).toString().isEmpty()) {
+            res->tree->expandItem(curr);  // probably file above if this is reached
+        }
+        curr = res->tree->itemAbove(startChild);
+    }
+
     // skip file name items and the root item
     while (curr && curr->data(0, ReplaceMatches::ColumnRole).toString().isEmpty()) {
         curr = res->tree->itemAbove(curr);
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic