From 2913b027d7e793390ed489ef6a47d23ec9b3c800 Mon Sep 17 00:00:00 2001 From: "Miao, ZhiCheng" Date: Tue, 16 Jul 2024 01:38:36 +0300 Subject: [PATCH] Support cross platform vty 6.x with vty-crossplatform --- lib/Echidna/UI.hs | 13 +++++++------ package.yaml | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/Echidna/UI.hs b/lib/Echidna/UI.hs index fbe02c099..fe3042c9c 100644 --- a/lib/Echidna/UI.hs +++ b/lib/Echidna/UI.hs @@ -8,7 +8,8 @@ import Brick import Brick.BChan import Brick.Widgets.Dialog qualified as B import Data.Sequence ((|>)) -import Graphics.Vty (Config, Event(..), Key(..), Modifier(..), defaultConfig, inputMap, mkVty) +import Graphics.Vty (VtyUserConfig (..), Event(..), Key(..), Modifier(..)) +import Graphics.Vty.CrossPlatform (mkVty) import Graphics.Vty qualified as Vty import System.Posix import Echidna.UI.Widgets @@ -243,12 +244,12 @@ stopWorkers :: MonadIO m => [(ThreadId, a)] -> m () stopWorkers workers = forM_ workers $ \(threadId, _) -> liftIO $ killThread threadId -vtyConfig :: IO Config +vtyConfig :: IO VtyUserConfig vtyConfig = do - config <- Vty.standardIOConfig - pure config { inputMap = (Nothing, "\ESC[6;2~", EvKey KPageDown [MShift]) : - (Nothing, "\ESC[5;2~", EvKey KPageUp [MShift]) : - inputMap defaultConfig } + config <- Vty.userConfig + pure config { configInputMap = (Nothing, "\ESC[6;2~", EvKey KPageDown [MShift]) : + (Nothing, "\ESC[5;2~", EvKey KPageUp [MShift]) : + configInputMap Vty.defaultConfig } -- | Check if we should stop drawing (or updating) the dashboard, then do the right thing. monitor :: MonadReader Env m => m (App UIState UIEvent Name) diff --git a/package.yaml b/package.yaml index 657cef0d3..be25c548b 100644 --- a/package.yaml +++ b/package.yaml @@ -81,6 +81,7 @@ when: - brick - unix - vty + - vty-crossplatform executables: echidna: