Declare Ctrl+C and Ctrl+D as priority Textual bindings so the focused prompt cannot consume them. Drive exit and silent-stream cancellation regressions through Pilot key events instead of calling action handlers directly.
This commit is contained in:
@@ -27,13 +27,14 @@ _APPROVAL_TIMEOUT = httpx.Timeout(10.0, connect=5.0)
|
||||
def _require_textual():
|
||||
try:
|
||||
from textual.app import App
|
||||
from textual.binding import Binding
|
||||
from textual.widgets import Footer, Header, Input, RichLog, Static
|
||||
except ImportError as e: # pragma: no cover - optional extra
|
||||
raise ImportError(
|
||||
"The interactive TUI needs the 'tui' extra — "
|
||||
"pip install 'nexusos-ai[tui]' (or: pip install textual)."
|
||||
) from e
|
||||
return App, Footer, Header, Input, RichLog, Static
|
||||
return App, Binding, Footer, Header, Input, RichLog, Static
|
||||
|
||||
|
||||
def _escape(text: str) -> str:
|
||||
@@ -154,7 +155,7 @@ class NexusTUI:
|
||||
|
||||
@staticmethod
|
||||
def build_app(*, api_url: str | None = None):
|
||||
App, Footer, Header, Input, RichLog, Static = _require_textual()
|
||||
App, Binding, Footer, Header, Input, RichLog, Static = _require_textual()
|
||||
base = (api_url or settings.api_url).rstrip("/")
|
||||
|
||||
class AppImpl(App):
|
||||
@@ -187,8 +188,8 @@ class NexusTUI:
|
||||
#prompt { dock: bottom; }
|
||||
"""
|
||||
BINDINGS = [
|
||||
("ctrl+c", "interrupt", "Interrupt"),
|
||||
("ctrl+d", "quit", "Quit"),
|
||||
Binding("ctrl+c", "interrupt", "Interrupt", priority=True),
|
||||
Binding("ctrl+d", "quit", "Quit", priority=True),
|
||||
]
|
||||
|
||||
def __init__(self):
|
||||
|
||||
Reference in New Issue
Block a user