Skip to content

Make debugger pause button work #144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion src/Debugger/Main.elm
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ type Msg msg
| UserMsg msg
| TweakExpandoMsg Expando.Msg
| TweakExpandoModel Expando.Msg
| Pause
| Resume
| Jump Int
| SliderJump Int
Expand Down Expand Up @@ -234,6 +235,22 @@ wrapUpdate update msg model =
, Cmd.none
)

Pause ->
case model.state of
Running _ ->
let
size = History.size model.history
in
if size == 0 then
( model, Cmd.none )
else
( jumpUpdate update (size - 1) model
Copy link
Author

@lydell lydell Jul 12, 2025

Choose a reason for hiding this comment

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

This does the same thing as dragging the slider.

If there is no history, jumpUpdate gets stuck in an infinite loop, so we explicitly check if there’s any history and do nothing if there aren’t.

, Cmd.none
)

Paused _ _ userModel userMsg _ ->
( model, Cmd.none )

Resume ->
case model.state of
Running _ ->
Expand Down Expand Up @@ -686,7 +703,7 @@ viewPlayButton playing =
, style "cursor" "pointer"
, style "width" "36px"
, style "height" "36px"
, onClick Resume
, onClick (if playing then Pause else Resume)
]
[ if playing
then icon "M2 2h4v12h-4v-12z M10 2h4v12h-4v-12z"
Expand Down