Skip to content

Conversation

@benodiwal
Copy link
Contributor

Closes #8408

Implements the `output` option for the `scroll-to-bottom` configuration,
which scrolls the viewport to the bottom when new lines are printed.

Co-Authored-By: Sachin <[email protected]>
@benodiwal benodiwal requested a review from a team as a code owner December 17, 2025 11:19
Copy link
Contributor

@mitchellh mitchellh left a comment

Choose a reason for hiding this comment

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

Thank you, but I'm not convinced this is the right approach. I suspect that this might slow down our IO throughput noticeably since newlines are common and we have to now add a conditional there. It may not though since the conditional will almost always be the same value.

If you can show benchmarks that may help...

But I still think the best way to do this would be to implement it in the renderer actually and have the frame build check if our final line changed pins at all and if so, to trigger a scroll.

@benodiwal
Copy link
Contributor Author

benodiwal commented Dec 17, 2025

Thanks @mitchellh! The renderer approach seems right.

I tried these three implementations:

  1. Stream Handler (termio/stream_handler.zig) <- Current commit
  • Checks on every \n in linefeed()
  1. Renderer - Scrollbar Total (renderer/generic.zig)
  • Compares scrollbar.total between frames in updateFrame()
  1. Renderer - Pin Tracking (renderer/generic.zig) ← your suggestion
  • Checks if final line's pin changed (node pointer or y offset)

I have all three ready on my local. I would like your input on 2 as well. It seems simpler since it reuses existing scrollbar data without adding new fields.

@benodiwal benodiwal requested a review from a team as a code owner December 18, 2025 00:15
The renderer approach doesn't need termio changes.

Co-Authored-By: Sachin <[email protected]>
@benodiwal
Copy link
Contributor Author

I have pushed the changes according to the approach you suggested using Pin Tracking.

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.

Add scroll-to-bottom configuration to control scrolling behavior

2 participants