Skip to content

feat(tui): configurable scrollback length #10247

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

Merged
merged 6 commits into from
Apr 7, 2025
Merged

feat(tui): configurable scrollback length #10247

merged 6 commits into from
Apr 7, 2025

Conversation

anthonyshew
Copy link
Contributor

@anthonyshew anthonyshew commented Mar 29, 2025

Description

Allow users to set a different value for scrollback length. I'm also taking a liberty to double the scrollback length's default value here (cc @chris-olszewski to tell me if this isn't a good idea)

Original asks:

Note

If you're wondering why we don't dynamically set this to whatever the terminal's scrollback is, terminals don't expose this value. The closest thing to a spec for terminals is the xterm spec, so we don't know what we can depend on.

Questions

Should this also be:

  • A turbo.json config?
    • Personally, I don't think so. Our reasoning for configurations in turbo.json tends to be that it should be something that makes sense for anyone in the repo, and setting some non-default scrollback length doesn't sound desirable.
  • A flag?
    • This sounds reasonable, but omitting here unless an ask comes in for it.

Testing Instructions

Try it!

@anthonyshew anthonyshew requested a review from a team as a code owner March 29, 2025 03:53
Copy link

vercel bot commented Mar 29, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-basic-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 31, 2025 8:12pm
examples-designsystem-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 31, 2025 8:12pm
examples-gatsby-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 31, 2025 8:12pm
examples-kitchensink-blog ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 31, 2025 8:12pm
examples-native-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 31, 2025 8:12pm
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 31, 2025 8:12pm
examples-svelte-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 31, 2025 8:12pm
examples-tailwind-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 31, 2025 8:12pm
examples-vite-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 31, 2025 8:12pm
turbo-site ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 31, 2025 8:12pm

@@ -7,7 +7,15 @@ use super::{
Error,
};

const SCROLLBACK_LEN: usize = 1024;
const SCROLLBACK_LEN: usize = 2048;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making sure to call extra attention here: Users mentioned they felt 1024 was too small, so I doubled it here. Not sure about if there's a reason I shouldn't do this or if a different value should be used. Just did this for the sake of discussion.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is okay since #9123 has been merged.

vt100 used to need to iterate through every scrollback row in order to render a visible row so 1024->2048 would be a noticeable perf hit. I will do a quick profile to check if there's a noticeable impact from this change.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a test and this is a :shipit: no noticeable perf change

@lbennett-stacki
Copy link

lbennett-stacki commented Mar 31, 2025

Thanks @anthonyshew this looks great! 🙏🙇 We could also maybe fallback to the HISTSIZE env var?

Copy link
Member

@chris-olszewski chris-olszewski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're gonna add a config option, then we should do it right. (Gotta keep the dream of code generated docs alive)

@chris-olszewski
Copy link
Member

@lbennett-stacki I don't think we want to use HISTSIZE as a source for this value. HISTSIZE is meant to target the shell history and not terminal scrollback. It would be confusing if we used it as the scrollback buffer length

The value of the HISTSIZE shell variable is used as the number of commands to save in a history list. The text of the last $HISTSIZE commands (default 500) is saved.

https://www.gnu.org/software/bash/manual/html_node/Bash-History-Facilities.html

@anthonyshew
Copy link
Contributor Author

(Gotta keep the dream of code generated docs alive)

It's not a dream, it's real. /s

If we're gonna add a config option

I wasn't going to do so in this PR. I was just going to leave it at the env var. Are you saying we should do one?

@chris-olszewski
Copy link
Member

Are you saying we should do one?

Sorry, I meant "config option" in the most general sense of a way to configure how turbo behaves. Just meant that we should try to keep our list of env vars here: https://github.com/vercel/turborepo/blob/main/crates/turborepo-lib/src/config/env.rs

@anthonyshew
Copy link
Contributor Author

Using #10261 to break things up into PRs that only do one thing.

anthonyshew added a commit that referenced this pull request Mar 31, 2025
### Description

Breaking up #10247 into PRs that
only do one thing. This handles the bump for default scrollback length.

Performance was assessed here:
#10247 (comment)

### Testing Instructions

👀
@anthonyshew
Copy link
Contributor Author

@chris-olszewski, I refactored. Can you take another look?

@chris-olszewski chris-olszewski self-requested a review April 7, 2025 19:04
Copy link
Member

@chris-olszewski chris-olszewski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LFG

@anthonyshew anthonyshew merged commit 3f46601 into main Apr 7, 2025
38 checks passed
@anthonyshew anthonyshew deleted the shew/f7943 branch April 7, 2025 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants