Fix: non-scrollable textview has strange behavior#342
Closed
dzpao wants to merge 1 commit intorivo:masterfrom
Closed
Fix: non-scrollable textview has strange behavior#342dzpao wants to merge 1 commit intorivo:masterfrom
dzpao wants to merge 1 commit intorivo:masterfrom
Conversation
This should fix rivo#341
Author
|
In order to explain the problem more clearly, I wrote a short example. If you run the example with the master version, you can see that every time the screen is full, it will be emptied. With patch applied, the screen will continue to scroll up without being emptied. I think this is more in line with people's expectations. package main
import (
"fmt"
"time"
"github.com/rivo/tview"
)
func main() {
app := tview.NewApplication()
textView := tview.NewTextView().
SetScrollable(false).
SetChangedFunc(func() {
app.Draw()
})
go func() {
i := 0
for {
fmt.Fprintf(textView, "%d\n", i)
i++
time.Sleep(200 * time.Millisecond)
}
}()
textView.SetBorder(true)
mainView := tview.NewFlex().
SetDirection(tview.FlexRow).
AddItem(textView, 10, 1, true)
if err := app.SetRoot(mainView, true).Run(); err != nil {
panic(err)
}
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It seems that there are two lines of code that are upside down.
This should fix #341