Skip to content

Commit

Permalink
fix(am-dbg): make LogUserScrolled pause the timeline
Browse files Browse the repository at this point in the history
  • Loading branch information
pancsta committed Jul 16, 2024
1 parent 05dc78f commit 1120c68
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
12 changes: 4 additions & 8 deletions tools/debugger/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,9 @@ func (d *Debugger) rebuildLog(ctx context.Context, endIndex int) error {
return err
}

// prevent scrolling when not in tail mode
if d.Mach.Not(am.S{ss.TailMode, ss.LogUserScrolled}) {
// scroll, but only if not manually scrolled
if d.Mach.Not1(ss.LogUserScrolled) {
d.log.ScrollToHighlight()
} else if d.Mach.Not1(ss.TailMode) {
d.log.ScrollToEnd()
}

return nil
Expand All @@ -160,11 +158,9 @@ func (d *Debugger) appendLogEntry(index int) error {
return err
}

// prevent scrolling when not in tail mode
if d.Mach.Not(am.S{ss.TailMode, ss.LogUserScrolled}) {
// scroll, but only if not manually scrolled
if d.Mach.Not1(ss.LogUserScrolled) {
d.log.ScrollToHighlight()
} else if d.Mach.Not1(ss.TailMode) {
d.log.ScrollToEnd()
}

return nil
Expand Down
6 changes: 3 additions & 3 deletions tools/debugger/states/ss_dbg.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ var States = am.Struct{
Require: S{ClientSelected},
Remove: GroupDialog,
},
LogUserScrolled: {},
LogUserScrolled: {Remove: S{Playing, TailMode}},
Ready: {Require: S{Start}},
FilterAutoTx: {},
FilterCanceledTx: {},
Expand All @@ -70,7 +70,7 @@ var States = am.Struct{
TreeMatrixView: {Remove: GroupViews},
TailMode: {
Require: S{ClientSelected},
Remove: GroupPlaying,
Remove: am.SMerge(GroupPlaying, S{LogUserScrolled}),
},
Playing: {
Require: S{ClientSelected},
Expand Down Expand Up @@ -108,7 +108,7 @@ var States = am.Struct{
},
ClientSelected: {
Require: S{Start},
Remove: S{SelectingClient, LogUserScrolled},
Remove: S{SelectingClient},
},
RemoveClient: {Require: S{ClientSelected}},
}
Expand Down

0 comments on commit 1120c68

Please sign in to comment.