mirror of
https://github.com/bec-project/bec_widgets.git
synced 2026-07-26 21:22:58 +02:00
fix: update Ctrl+C handling in BecConsole to support shared terminal sessions
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user