mirror of
https://github.com/CrystalSplitter/ghcitui.git
synced 2024-11-25 22:13:03 +03:00
Rename SourceWindowEvents Callbacks
This makes them match the other naming conventions.
This commit is contained in:
parent
edb698db99
commit
dbfdee38ff
@ -30,8 +30,8 @@ type AppEventCompletions = [T.Text]
|
|||||||
-- | Callback event types.
|
-- | Callback event types.
|
||||||
data CustomAppEvent state
|
data CustomAppEvent state
|
||||||
= ErrorOnCb state T.Text
|
= ErrorOnCb state T.Text
|
||||||
| RedrawStepCb state
|
| StepCb state
|
||||||
| RedrawBreakpointCb state Loc.ModuleLoc
|
| BreakpointCb state Loc.ModuleLoc
|
||||||
| ReplExecCb state AppEventCmd AppEventLogs
|
| ReplExecCb state AppEventCmd AppEventLogs
|
||||||
| ReplTabCompleteCb state AppEventCmd (AppEventPrefix, AppEventCompletions)
|
| ReplTabCompleteCb state AppEventCmd (AppEventPrefix, AppEventCompletions)
|
||||||
deriving (Eq, Show, Ord)
|
deriving (Eq, Show, Ord)
|
||||||
|
@ -38,15 +38,15 @@ handleSrcWindowEvent (B.VtyEvent (V.EvKey key ms))
|
|||||||
-- GHCi Blocking Events.
|
-- GHCi Blocking Events.
|
||||||
| key == V.KChar 's' = do
|
| key == V.KChar 's' = do
|
||||||
appState@AppState.AppState{AppState.interpState} <- B.get
|
appState@AppState.AppState{AppState.interpState} <- B.get
|
||||||
let callback = redrawStepCb appState
|
let callback = stepCb appState
|
||||||
liftIO $ Daemon.scheduleWithCb interpState (Daemon.step interpState) callback
|
liftIO $ Daemon.scheduleWithCb interpState (Daemon.step interpState) callback
|
||||||
| key == V.KChar 'c' = do
|
| key == V.KChar 'c' = do
|
||||||
appState@AppState.AppState{AppState.interpState} <- B.get
|
appState@AppState.AppState{AppState.interpState} <- B.get
|
||||||
let callback = redrawStepCb appState
|
let callback = stepCb appState
|
||||||
liftIO $ Daemon.scheduleWithCb interpState (Daemon.step interpState) callback
|
liftIO $ Daemon.scheduleWithCb interpState (Daemon.step interpState) callback
|
||||||
| key == V.KChar 't' = do
|
| key == V.KChar 't' = do
|
||||||
appState@AppState.AppState{AppState.interpState} <- B.get
|
appState@AppState.AppState{AppState.interpState} <- B.get
|
||||||
let callback = redrawStepCb appState
|
let callback = stepCb appState
|
||||||
liftIO $ Daemon.scheduleWithCb interpState (Daemon.trace interpState) callback
|
liftIO $ Daemon.scheduleWithCb interpState (Daemon.trace interpState) callback
|
||||||
| key == V.KChar 'b' = do
|
| key == V.KChar 'b' = do
|
||||||
appState <- B.get
|
appState <- B.get
|
||||||
@ -85,16 +85,16 @@ handleSrcWindowEvent _ = pure ()
|
|||||||
{- | Redraw Step Callback. Called asynchronously after the 'DaemonIO' resolves
|
{- | Redraw Step Callback. Called asynchronously after the 'DaemonIO' resolves
|
||||||
for 'step' and similar.
|
for 'step' and similar.
|
||||||
-}
|
-}
|
||||||
redrawStepCb
|
stepCb
|
||||||
:: AppState n
|
:: AppState n
|
||||||
-- ^ 'AppState' to use for asynchronous channel communication.
|
-- ^ 'AppState' to use for asynchronous channel communication.
|
||||||
-> Either Daemon.DaemonError (Daemon.InterpState ())
|
-> Either Daemon.DaemonError (Daemon.InterpState ())
|
||||||
-- ^ The incoming response from the Daemon for the 'step' (or similar) operation.
|
-- ^ The incoming response from the Daemon for the 'step' (or similar) operation.
|
||||||
-> IO ()
|
-> IO ()
|
||||||
-- ^ IO used to write to the event bounded channel.
|
-- ^ IO used to write to the event bounded channel.
|
||||||
redrawStepCb appState (Right interpState) =
|
stepCb appState (Right interpState) =
|
||||||
B.writeBChan (AppState.eventChannel appState) (RedrawStepCb appState{interpState})
|
B.writeBChan (AppState.eventChannel appState) (StepCb appState{interpState})
|
||||||
redrawStepCb appState (Left msg) =
|
stepCb appState (Left msg) =
|
||||||
B.writeBChan (AppState.eventChannel appState) (ErrorOnCb appState (showT msg))
|
B.writeBChan (AppState.eventChannel appState) (ErrorOnCb appState (showT msg))
|
||||||
|
|
||||||
breakpointCb
|
breakpointCb
|
||||||
@ -105,17 +105,17 @@ breakpointCb
|
|||||||
breakpointCb moduleLoc appState (Right interpState) =
|
breakpointCb moduleLoc appState (Right interpState) =
|
||||||
B.writeBChan
|
B.writeBChan
|
||||||
(AppState.eventChannel appState)
|
(AppState.eventChannel appState)
|
||||||
(RedrawBreakpointCb appState{interpState} moduleLoc)
|
(BreakpointCb appState{interpState} moduleLoc)
|
||||||
breakpointCb _ appState (Left msg) =
|
breakpointCb _ appState (Left msg) =
|
||||||
B.writeBChan (AppState.eventChannel appState) (ErrorOnCb appState (showT msg))
|
B.writeBChan (AppState.eventChannel appState) (ErrorOnCb appState (showT msg))
|
||||||
|
|
||||||
-- | Synchronous code to update the state after a SourceWindowEvent callback.
|
-- | Synchronous code to update the state after a SourceWindowEvent callback.
|
||||||
handleSourceWindowPostCb
|
handleSourceWindowPostCb
|
||||||
:: CustomAppEvent (AppState AppName) -> B.EventM AppName (AppState AppName) ()
|
:: CustomAppEvent (AppState AppName) -> B.EventM AppName (AppState AppName) ()
|
||||||
handleSourceWindowPostCb (RedrawStepCb appState) = do
|
handleSourceWindowPostCb (StepCb appState) = do
|
||||||
B.put =<< AppState.selectPausedLine appState
|
B.put =<< AppState.selectPausedLine appState
|
||||||
invalidateLineCache
|
invalidateLineCache
|
||||||
handleSourceWindowPostCb (RedrawBreakpointCb appState moduleLoc) = do
|
handleSourceWindowPostCb (BreakpointCb appState moduleLoc) = do
|
||||||
let interpState = AppState.interpState appState
|
let interpState = AppState.interpState appState
|
||||||
-- We may need to be smarter about this,
|
-- We may need to be smarter about this,
|
||||||
-- because there's a chance that the module loc 'ml'
|
-- because there's a chance that the module loc 'ml'
|
||||||
|
Loading…
Reference in New Issue
Block a user