OpenTUI: ctrl-z background controls are broken
Description
Since OpenTUI got merged, the ctrl-z background controls functionality got masked by the text box undo feature
OpenCode version
1.0.11
Steps to reproduce
- open tui session
- write some prompt
- press ctrl-z
- text is undo'ed instead of going to background
Screenshot and/or share link
https://github.com/user-attachments/assets/3dc13815-5139-48c5-a9cd-d7ede26fb85b
Operating System
macOS 26.0.1
Terminal
Ghostty
Opencode needs to re-map the undo for the Textarea to not collide with other mappings.
Could I take this up?
I was thinking ctrl + Z can be undo and ctrl + shift + z can be suspend?
I've started to look into it.
https://github.com/goniz/opencode/commit/949f037d5ad60856aea25f0efe6343ff5f110cdd
Wdyt about this approach? It's not done yet but the suspend part works
@kommander
Could I take this up?
I was thinking ctrl + Z can be undo and ctrl + shift + z can be suspend?
In my opinion the terminal's native behaviors should take priority over the textarea editing behavior.
In warp, it is undo in its "text area" hence my suggestion but yeah, I get that.
In warp, it is undo in its "text area" hence my suggestion but yeah, I get that.
So annoying 😂😵 But yeah, that's my own preference
ctrl+z should not be mapped by default anymore
As of 1.0.74 it's still not working on MacOS (in iTerm2 at least).
As of 1.0.74 it's still not working on MacOS (in iTerm2 at least).
I have a PR open at https://github.com/sst/opencode/pull/3983
It's working but still has some artifacts due to incomplete shutdown sequence in opentui. I still haven't had the time to figure out and fix
If it matters, my 2¢: that's what /editor is for; get rid of undo & let ^Z do its default thing -> add an optional keybind for people who really really want undo in the TUI.
If it matters, my 2¢: that's what
/editoris for; get rid of undo & let ^Z do its default thing -> add an optional keybind for people who really really want undo in the TUI.
It's already implemented as you described. Undo&redo were mapped to alternative key bindings by @kommander and my PR implements the default terminal behavior to enable background and foreground terminal controls