Skip to content

Commit

Permalink
fix: Real time GUI log only shows 4 lines #299
Browse files Browse the repository at this point in the history
  • Loading branch information
simulot committed Jul 13, 2024
1 parent 0d9e832 commit 57a0dd7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cmd/upload/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ type uiPage struct {

func (app *UpCmd) runUI(ctx context.Context) error {
ctx, cancel := context.WithCancelCause(ctx)
ui := newUI(ctx, app)

uiApp := tview.NewApplication()
ui := newUI(ctx, app, uiApp)

defer cancel(nil)
pages := tview.NewPages()
Expand All @@ -50,7 +52,6 @@ func (app *UpCmd) runUI(ctx context.Context) error {
var uploadDone atomic.Bool
var uiGroup errgroup.Group

uiApp := tview.NewApplication()
uiApp.SetRoot(pages, true)

stopUI := func(err error) {
Expand Down Expand Up @@ -231,7 +232,7 @@ func newModal() tview.Primitive {
return modal(text, 40, 7)
}

func newUI(ctx context.Context, app *UpCmd) *uiPage {
func newUI(ctx context.Context, app *UpCmd, uiApp *tview.Application) *uiPage {
ui := &uiPage{
counts: map[fileevent.Code]*tview.TextView{},
}
Expand Down Expand Up @@ -288,7 +289,7 @@ func newUI(ctx context.Context, app *UpCmd) *uiPage {
ui.screen.AddItem(counts, 1, 0, 1, 1, 0, 0, false)

// Hijack the log
ui.logView = tview.NewTextView().SetMaxLines(5).ScrollToEnd()
ui.logView = tview.NewTextView().SetMaxLines(100).ScrollToEnd()
ui.prevSlog = app.SharedFlags.Log

if app.SharedFlags.LogWriterCloser != nil {
Expand Down

0 comments on commit 57a0dd7

Please sign in to comment.