-
Notifications
You must be signed in to change notification settings - Fork 27
feat(ui): add dynamic input window toggle #156
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
Conversation
|
@sudo-tee curious to hear if you had any thoughts on this if you had a chance to try it out.
|
|
I didn't had time to look at it yet. Been busy with the holidays and family. But I will look at it pretty soon |
sudo-tee
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea.
However the implementation feels a bit rough. There is a good amount of layout shifting when toggling the input.
When I move the cursor to the code window the input should also auto_hide, as it feels weird that it hide when focusing back to the opencode window. I attached a video
Screen.Recording.2026-01-05.074018.mp4
I think a better solution would be to make the input a floating window when in auto_hide mode, it would reduce the layout shifting.
What do you think ?
The permission request seems to have changed it's format I updated the permission handling to support both format This should fix #156
I mostly used this in full-screen mode
I think a floating window would add some additional complexities. Ideally when the input window is being hidden, we want to the output window to maximize it's size (so static padding wouldn't be ideal), we also don't want to hide the latest text of the output window behind the input window when the input window is open. Perhaps this can be explored in a future dedicated PR if there's a way to make this better through a float though I'm a bit skeptical. |
- introduce toggle_input function to manage input window visibility - add keybindings for toggling input window - implement auto-hide behavior for input window after message submission - adjust focus handling to include hidden input window Closes sudo-tee#123
19b6ce1 to
69d6d6d
Compare
This is reasonable as long as it's not the default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine now as it is not the default behavior.
The only thing needed is to remove unnecessary comments. Most of the time it's pretty obvious on what the code does. I commented on a couple of ones as example.
- adjust scroll_to_bottom function to include a force parameter - ensure auto-scrolling respects user scroll position unless forced
|
Fixed some auto-scrolling so the dynamic input window doesn't block the latest text. |
|
Thanks for the fixes. It should be good to go |
Summary
ui.input.dynamicconfig option that automatically hides the input window when focus moves to the output window or when a prompt is submittedMotivation
When working with AI responses, the output window benefits from maximum screen real estate. The input window (especially when configured larger) takes up space that isn't needed while waiting for or reading responses. This feature allows the input window to stay out of the way until you're ready to type the next prompt.
Features
Toggle Input Window
toggle_inputAPI function and command (:Opencode toggle_input)<M-i>(Alt+i) in both input and output windowsDynamic Input Mode (
ui.input.auto_hide = true)<cr>)<C-w>commands, etc.)focus_input,open_input, ortoggle_paneBug Fixes
Auto-scroll preservation during dynamic input resize
When the input window hides/shows with
dynamic = true, the output window resizes. This could incorrectly updateviewport_at_bottomvia theWinScrolledautocmd, breaking auto-scroll. Fixed by:was_at_bottomstate before hide/showscroll_to_bottom()after resize if previously at bottomTab keymap conflicts with completion plugins
<Tab>toggle focus mapping to only trigger in normal mode, preventing conflicts with auto-complete mappings that use<Tab>in insert modeTest Fixes
Date formatting tests fail on year boundaries (CI)
Tests for
util.format_timefailed when run on year boundaries (e.g., Jan 1, 2026):31 Dec 09:46 PMbut got31 Dec 2025 09:46 PM(year included because Dec 31 is a different year than Jan 1)Fix: Made tests year-boundary-aware by checking if test dates fall in the same year as today before asserting the expected format pattern.
Files Changed
lua/opencode/api.lua- Addtoggle_input, updatesubmit_input_prompt,togglelua/opencode/config.lua- Addui.input.dynamicoption and keymapslua/opencode/ui/autocmds.lua- Prevent closing all windows during togglelua/opencode/ui/input_window.lua- Addtoggle,_hide,_show,is_hiddenfunctions; preserve scroll positionlua/opencode/ui/output_window.lua- Auto-hide input on focus when dynamic enabledlua/opencode/ui/ui.lua- Handle hidden state infocus_input, simplifytoggle_panetests/unit/util_spec.lua- Fix year-boundary-aware date formatting tests