Fix inputMap (issue #474) (#503)

* Fix inputMap (issue #474)

* hlint for fix inputMap (issue #474)
pull/512/head
erivas 4 years ago committed by GitHub
parent 88d391dd9f
commit cb2ea5cb2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      lib/Echidna/UI.hs

@ -21,7 +21,7 @@ import Data.Has (Has(..))
import Data.Maybe (fromMaybe)
import Data.IORef
import EVM (VM)
import Graphics.Vty (Event(..), Key(..), Modifier(..), defaultConfig, mkVty)
import Graphics.Vty (Config, Event(..), Key(..), Modifier(..), defaultConfig, inputMap, mkVty)
import System.Posix.Terminal (queryTerminal)
import System.Posix.Types (Fd(..))
import UnliftIO (MonadUnliftIO)
@ -55,6 +55,12 @@ makeLenses ''UIConf
data CampaignEvent = CampaignUpdated Campaign | CampaignTimedout Campaign
vtyConfig :: Config
vtyConfig = defaultConfig { inputMap = (Nothing, "\ESC[6;2~", EvKey KPageDown [MShift]) :
(Nothing, "\ESC[5;2~", EvKey KPageUp [MShift]) :
inputMap defaultConfig
}
-- | Check if we should stop drawing (or updating) the dashboard, then do the right thing.
monitor :: (MonadReader x m, Has CampaignConf x, Has Names x, Has TxConf x)
=> m (App (Campaign, UIState) CampaignEvent ())
@ -105,7 +111,7 @@ ui v w ts d txs = do
Just _ -> liftIO $ updateUI CampaignUpdated
)
(const $ liftIO $ killThread ticker)
app <- customMain (mkVty defaultConfig) (Just bc) <$> monitor
app <- customMain (mkVty vtyConfig) (Just bc) <$> monitor
liftIO $ void $ app (defaultCampaign, Uninitialized)
final <- liftIO $ readIORef ref
liftIO . putStrLn =<< ppCampaign final

Loading…
Cancel
Save