Optimize the services implementation

Dont construct the selection string when we are merely checking if a
selection exists.
This commit is contained in:
Kovid Goyal
2023-02-01 12:46:19 +05:30
parent 1c6bae636b
commit 682428fb54
10 changed files with 55 additions and 9 deletions
+6
View File
@@ -1985,6 +1985,12 @@ class Boss:
return w.text_for_selection()
return None
def has_active_selection(self) -> bool:
w = self.active_window
if w is not None and not w.destroyed:
return w.has_selection()
return False
@ac('cp', '''
Copy the selection from the active window to the specified buffer