Skip to content

Commit

Permalink
On C-c, only cancel base CESK if it is currently running (#2008)
Browse files Browse the repository at this point in the history
Fixes #2007.  After #1928, we handle exceptions a little differently, so it no longer works to simply set the base's CESK machine to an `Up` (exception) state no matter what.  Instead we have to first check if the base is running, and if so set it to `Up` as before; if not, do nothing (except clear the REPL prompt).
  • Loading branch information
byorgey authored Jul 1, 2024
1 parent 6b58979 commit 9b1b698
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/swarm-tui/Swarm/TUI/Controller.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,8 @@ handleREPLEvent x = do
-- Handle Ctrl-c here so we can always cancel the currently running
-- base program no matter what REPL control mode we are in.
ControlChar 'c' -> do
gameState . baseRobot . machine %= cancel
working <- use $ gameState . gameControls . replWorking
when working $ gameState . baseRobot . machine %= cancel
Brick.zoom (uiState . uiGameplay . uiREPL) $ do
replPromptType .= CmdPrompt []
replPromptText .= ""
Expand Down

0 comments on commit 9b1b698

Please sign in to comment.