-
Notifications
You must be signed in to change notification settings - Fork 3.7k
resizable viewport #1732
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
resizable viewport #1732
Conversation
codex-rs/tui/src/custom_terminal.rs
Outdated
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.
Just a quick reminder. Please follow the MIT license conditions. The easiest way is to copy the license into your NOTICES file. I encourage liberal copying and modification of source code like this, with appropriate attribution being the only real requirement.
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.
pulled it into this file directly, i'm not sure exactly how our distribution works and what notices are shipped with the binaries but would be happy to include this notice there too.
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.
This sounds ok to me. I don't recall exactly whether any runtime license notice requirement is required. When I last researched this I was unable to find any definitive guidance on what the right approach is. I suspect every company at some point has this come up and lawyers work out an interpretation that works for them™ ;)
I've been meaning to sometime broach with the rest of the team making Ratatui dual licensed as Apache 2, and doing the right thing to include the standard license headers like this in each file, which would make it a bit easier to do things like this.
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.
Very small questions, but please address the points raised by @joshka before submitting!
Proof of concept for a resizable viewport.
The general approach here is to duplicate the
Terminal
struct from ratatui, but with our own logic. This is a "light fork" in that we are still using all the base ratatui functions (Buffer
,Widget
and so on), but we're doing our own bookkeeping at the top level to determine where to draw everything.This approach could use improvement—e.g, when the window is resized to a smaller size, if the UI wraps, we don't correctly clear out the artifacts from wrapping. This is possible with a little work (i.e. tracking what parts of our UI would have been wrapped), but this behavior is at least at par with the existing behavior.
Screen.Recording.2025-07-29.at.4.03.50.PM.mov
cc @joshka who might have Thoughts™