[kupfer] browser: Never show an empty match. Keep latest result.



commit 2289eb28bff1ad07ebedcda2f1f817f1ed708faa
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Wed Jan 6 01:43:38 2010 +0100

    browser: Never show an empty match. Keep latest result.
    
    We never show an empty match for a search query, but keep the latest
    result.
    
    The Hypothesis is that the user does not gain from "No action for
    '..'" or "No matches for '..' inside '..'" -- if you type a good query
    but with a wrong letter at the end, it can be frustrating.
    
    With this change, we simply "freeze" when no matches are found for a
    query; we simply refuse updating the interface and keep the latest
    match(es) displayed.

 kupfer/browser.py |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/kupfer/browser.py b/kupfer/browser.py
index cf5fdc2..ece9740 100644
--- a/kupfer/browser.py
+++ b/kupfer/browser.py
@@ -1236,7 +1236,15 @@ class Interface (gobject.GObject):
 		self._activate(None, None)
 	
 	def _search_result(self, sender, pane, matchrankable, matches, context):
+		# NOTE: "Always-matching" search.
+		# If we receive an empty match, we ignore it, to retain the previous
+		# results. The user is not served by being met by empty results.
 		key = context
+		if key and len(key) > 1 and matchrankable is None:
+			# with typos or so, reset quicker
+			self._latest_input_timer.set(self._slow_input_interval/2,
+					self._relax_search_terms)
+			return
 		wid = self._widget_for_pane(pane)
 		wid.update_match(key, matchrankable, matches)
 



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