[GH-ISSUE #907] TextView can now scroll past the end of the text #658

Closed
opened 2026-03-04 01:06:50 +03:00 by kerem · 3 comments
Owner

Originally created by @polothy on GitHub (Oct 31, 2023).
Original GitHub issue: https://github.com/rivo/tview/issues/907

Greetings!

Noticed a behavior change after upgrading recently and I'm not sure if it is intentional or configurable. It's easy to reproduce with the demo code, specifically I used this:

// Demo code for the TextView primitive.
package main

import (
	"github.com/rivo/tview"
)

const corporate = `Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment.

Bring to the table win-win survival strategies to ensure proactive domination. At the end of the day, going forward, a new normal that has evolved from generation X is on the runway heading towards a streamlined cloud solution. User generated content in real-time will have multiple touchpoints for offshoring.

Capitalize on low hanging fruit to identify a ballpark value added activity to beta test. Override the digital divide with additional clickthroughs from DevOps. Nanotechnology immersion along the information highway will close the loop on focusing solely on the bottom line.

[yellow]Press Enter, then Tab/Backtab for word selections`

func main() {
	app := tview.NewApplication()
	textView := tview.NewTextView().
		SetDynamicColors(true).
		SetRegions(true).
		SetWordWrap(true).
		SetChangedFunc(func() {
			app.Draw()
		})
	textView.SetText(corporate)
	textView.SetBorder(true)
	if err := app.SetRoot(textView, true).EnableMouse(true).Run(); err != nil {
		panic(err)
	}
}

If I checkout 892d1a2, I get the behavior that I'm familiar with, the text view doesn't scroll unless I make my terminal window really small. And then it'll scroll up/down to the start/end of the text.

If I checkout master (2dfe060117) and re-run the program and then hit down arrow, I can start scrolling down past the end of the text. I can scroll until nothing is shown as well.

Another interesting key combo on master branch, if I hit End key, then down arrow, it's the old behavior (doesn't scroll down anymore). But if I hit up arrow then hit down arrow, I can start scrolling past the end again.

I suspect github.com/rivo/tview@7344139b55 introduced the change, but I couldn't spot anything.

Again, sorry if this is intentional - maybe I need to set something on my end to change behavior. Either way, thanks! Great package!

Originally created by @polothy on GitHub (Oct 31, 2023). Original GitHub issue: https://github.com/rivo/tview/issues/907 Greetings! Noticed a behavior change after upgrading recently and I'm not sure if it is intentional or configurable. It's easy to reproduce with the demo code, specifically I used this: ```go // Demo code for the TextView primitive. package main import ( "github.com/rivo/tview" ) const corporate = `Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment. Bring to the table win-win survival strategies to ensure proactive domination. At the end of the day, going forward, a new normal that has evolved from generation X is on the runway heading towards a streamlined cloud solution. User generated content in real-time will have multiple touchpoints for offshoring. Capitalize on low hanging fruit to identify a ballpark value added activity to beta test. Override the digital divide with additional clickthroughs from DevOps. Nanotechnology immersion along the information highway will close the loop on focusing solely on the bottom line. [yellow]Press Enter, then Tab/Backtab for word selections` func main() { app := tview.NewApplication() textView := tview.NewTextView(). SetDynamicColors(true). SetRegions(true). SetWordWrap(true). SetChangedFunc(func() { app.Draw() }) textView.SetText(corporate) textView.SetBorder(true) if err := app.SetRoot(textView, true).EnableMouse(true).Run(); err != nil { panic(err) } } ``` If I checkout 892d1a2, I get the behavior that I'm familiar with, the text view doesn't scroll unless I make my terminal window really small. And then it'll scroll up/down to the start/end of the text. If I checkout master (2dfe060117906c7e8654ff9f8ca3c99803bdd69c) and re-run the program and then hit down arrow, I can start scrolling down past the end of the text. I can scroll until nothing is shown as well. Another interesting key combo on master branch, if I hit End key, then down arrow, it's the old behavior (doesn't scroll down anymore). But if I hit up arrow then hit down arrow, I can start scrolling past the end again. I suspect https://github.com/rivo/tview/commit/7344139b5532c2f04b436664643246d86afcc853 introduced the change, but I couldn't spot anything. Again, sorry if this is intentional - maybe I need to set something on my end to change behavior. Either way, thanks! Great package!
kerem closed this issue 2026-03-04 01:06:50 +03:00
Author
Owner

@rivo commented on GitHub (Nov 2, 2023):

Thank you for reporting this. The adjustment of the line offset must have gotten lost in the recent changes. The latest commit should fix this.

<!-- gh-comment-id:1791304901 --> @rivo commented on GitHub (Nov 2, 2023): Thank you for reporting this. The adjustment of the line offset must have gotten lost in the recent changes. The latest commit should fix this.
Author
Owner

@polothy commented on GitHub (Nov 3, 2023):

Thanks so much, I'll try it out on Monday!

<!-- gh-comment-id:1792654397 --> @polothy commented on GitHub (Nov 3, 2023): Thanks so much, I'll try it out on Monday!
Author
Owner

@polothy commented on GitHub (Nov 6, 2023):

Fix worked, thanks!

<!-- gh-comment-id:1796471614 --> @polothy commented on GitHub (Nov 6, 2023): Fix worked, thanks!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#658
No description provided.