-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add Textual TUI #2462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add Textual TUI #2462
Conversation
This looks amazing! Very excited to see it land! |
Hi @willmcgugan, before we proceed, there's a few fundamental things I want to make sure we're aligned on.
![]() |
The default MacOS terminal is old, slow, and limited to 256 colors (which is why it looks bad). All other terminal support 16.7 million colors and have done for years. I could encourage you to switch to iTerm2, Kitty, wezterm, or Ghostty which are miles better and actively developed. It wouldn't be difficult to pick a default theme that looks better in 256 colors, and save it as a setting. Or you could wait for the forthcoming macOS Tahoe this year, which should finally have an update to the terminal.
I suspect you are alluding to it working the way Rich live works, by updating the scrollback buffer. Doing it that way is slow and prone to flicker. You also can't copy without also copying hard line breaks and other non-text characters. If you want a half decent UX then the TUI needs to use the "alternate buffer", which allows the app to manage the "screen".
ctrl+q to quit. You could add that to the footer.
macOS terminal doesn't support the copy to clipboard extension. Virtually all other terminals you can use ctrl+C to copy. |
You can use ansi colors (i.e. the color theme you set in your terminal), by setting |
Having better copy-paste support in particular is sort of a hard requirement for us to move forward with this. It doesn't seem no one in our team could make it work. As a note, it doesn't seem signals are being handled. Is it supposed to be handled in Textual or we need to handle in the application? |
Copy should work just about everywhere with ctrl+C. Paste is either ctrl+V or cmd+V on mac. What terminal are you using? Did you see my note about the macOS terminal? You can also revert to copying without the extension with a modifier key. iTerm Hold the OPTION key.
Which signals do you want to handled? Does this help? https://textual.textualize.io/guide/app/#suspending-from-foreground |
Warp, and the one that comes with VSCode.
On the first CTRL + C, I see the message "press CTRL + C to exit", and then I press, and I see the message again. I can't close with CTRL + C or CTRL + D. |
Well Warp isn't a terminal. But you could still petition them to implement the clipboard extension. Copying does indeed work in VSCode terminal -- I just tried. At least in the version I am using. What OS and Code version are you using?
There is no where I know of in Textual that outputs "press CTRL + C to exit". Could you send me a screenshot?
Ctrl+C is bound to copy to clipboard. Which is why we use ctrl+q to quit. You could change that, but you would need a new key to copy to clipboard. ctrl+D isn't bound to anything. But you could bind that to quit if you wish. Add this classvar to the App class: BINDINGS = [Binding('ctrl+d', 'quit', 'Quit the app', priority=True)] If ctrl+Q isn't working on VSCode, then it may be this issue: Textualize/textual#5968 Textual is pretty consistent on standalone terminal. Warp no longer claims to be a terminal, and has a bunch of idiosyncrasies. VScode does to, but you can generally fix those with config. |
This adds a Textual TUI for CLAI.
This has more or less feature parity with the existing TUI.
There is probably a little more work to do for error handling. And tools aren't yet implemented. Consider this a foundation to build upon.