Ask for confirmation before doing a clone by default

This commit is contained in:
Kovid Goyal
2022-04-16 20:04:26 +05:30
parent 53788c4c89
commit df9b13fb74
4 changed files with 31 additions and 2 deletions

View File

@@ -1015,8 +1015,11 @@ class Window:
if not msg:
if self.current_clone_data:
cdata, self.current_clone_data = self.current_clone_data, ''
from .launch import clone_and_launch
clone_and_launch(cdata, self)
get_boss().confirm(_(
'A program running in this window wants to clone it into another window.'
' Allow it do so, once?'),
partial(self.handle_remote_clone_confirmation, cdata), window=self,
)
self.current_clone_data = ''
return
num, rest = msg.split(':', 1)
@@ -1024,6 +1027,11 @@ class Window:
self.current_clone_data = ''
self.current_clone_data += rest
def handle_remote_clone_confirmation(self, cdata: str, confirmed: bool) -> None:
if confirmed:
from .launch import clone_and_launch
clone_and_launch(cdata, self)
def handle_remote_askpass(self, msg: str) -> None:
from .shm import SharedMemory
with SharedMemory(name=msg, readonly=True) as shm: