fix(spotlight): run immediate search on Enter when debounced results empty
on_entry_changed uses @debounce(300). When user presses Enter before debounce fires, _current_results is empty so nothing activates. Now on_entry_accept triggers an immediate search_single when active plugin has no results, and activates the first result on callback.
This commit is contained in:
1 file changed
+9
-3
@@ -638,10 +638,16 @@ class Spotlight(Box):
|
||||
return
|
||||
|
||||
if self._active_plugin_entry:
|
||||
inst = self._active_plugin_entry.instance
|
||||
if inst:
|
||||
inst.on_submit(entry.get_text())
|
||||
text = entry.get_text()
|
||||
entry.set_text("")
|
||||
|
||||
def _on_immediate_results(results):
|
||||
if results:
|
||||
self._activate_result(results[0])
|
||||
|
||||
self.plugin_service.pipeline.search_single(
|
||||
self._active_plugin_entry, text, _on_immediate_results
|
||||
)
|
||||
return
|
||||
|
||||
# External commands
|
||||
|
||||
Reference in new issue
Block a user