fix(clipboard): paste into the window the picker was opened from
The picker overlay is the active window while it is open, so pasting into the active window after a selection went nowhere once it closed. Remember the window the user was working in before showing the list.
This commit is contained in:
1 file changed
+7
-2
+7
-2
@@ -3171,10 +3171,15 @@ class Boss:
|
||||
self.ring_bell_if_allowed()
|
||||
return
|
||||
previews = [(text, self._clipboard_history_preview(text) or _('(blank)')) for text in entries]
|
||||
# The picker is itself the active window while it is open, so keep the window the user was
|
||||
# working in to paste into once it closes. The window can be gone by then.
|
||||
target = self.window_for_dispatch or self.active_window
|
||||
|
||||
def chosen(text: str | None) -> None:
|
||||
if text:
|
||||
self.paste_to_active_window(text)
|
||||
if text and target is not None:
|
||||
w = self.window_id_map.get(target.id)
|
||||
if w is not None:
|
||||
w.paste_with_actions(text)
|
||||
|
||||
self.choose_entry(_('Clipboard history'), previews, chosen)
|
||||
|
||||
|
||||
Reference in new issue
Block a user