fix: update Ctrl+C handling in BecConsole to support shared terminal sessions

This commit is contained in:
2026-07-07 15:05:44 +02:00
committed by wakonig_k
parent 6067311789
commit 909211f484
2 changed files with 15 additions and 2 deletions
@@ -332,8 +332,7 @@ class DeveloperWidget(DockAreaWidget):
"""Stop the execution of the currently running script"""
if not self.current_script_id:
return
if self.console.term is not None:
self.console.term.send_ctrl_c()
self.console.send_ctrl_c(regardless_of_ownership=True)
@property
def current_script_id(self):
@@ -543,6 +543,20 @@ class BecConsole(BECWidget, QWidget):
if term:
term.write(data, send_return)
def send_ctrl_c(self, regardless_of_ownership: bool = False):
"""
Send Ctrl+C to the console
Args:
regardless_of_ownership (bool): Whether to send to the shared terminal session even
when this console does not currently own the visible terminal widget.
"""
term = self.term
if term is None and regardless_of_ownership:
term = _bec_console_registry.get_terminal(self.terminal_id)
if term:
term.send_ctrl_c()
@property
def zoom_level(self) -> int:
return _bec_console_registry.zoom_level(self.terminal_id)