Update core library and demo programs to use vty-crossplatform to initialize the terminal

This commit is contained in:
Jonathan Daugherty 2023-08-20 08:37:40 -07:00
parent 2d6f90c629
commit dc046ca8ef
6 changed files with 17 additions and 8 deletions

View File

@ -96,6 +96,7 @@ library
build-depends: base >= 4.9.0.0 && < 4.19.0.0,
vty >= 5.36,
vty-crossplatform,
bimap >= 0.5 && < 0.6,
data-clist >= 0.1,
directory >= 1.2.5.0,
@ -159,6 +160,7 @@ executable brick-tail-demo
brick,
text,
vty,
vty-crossplatform,
random,
microlens-th,
microlens-mtl
@ -202,6 +204,7 @@ executable brick-form-demo
text,
microlens,
microlens-th,
vty-crossplatform,
vty
executable brick-text-wrap-demo
@ -259,6 +262,7 @@ executable brick-viewport-scrollbars-demo
build-depends: base,
brick,
vty,
vty-crossplatform,
text,
microlens,
microlens-mtl,
@ -449,6 +453,7 @@ executable brick-custom-event-demo
build-depends: base,
brick,
vty,
vty-crossplatform,
text,
microlens >= 0.3.0.0,
microlens-th,

View File

@ -12,6 +12,7 @@ import Control.Concurrent (threadDelay, forkIO)
import Data.Monoid
#endif
import qualified Graphics.Vty as V
import Graphics.Vty.CrossPlatform (mkVty)
import Brick.BChan
import Brick.Main
@ -82,6 +83,6 @@ main = do
writeBChan chan Counter
threadDelay 1000000
let buildVty = V.mkVty V.defaultConfig
let buildVty = mkVty V.defaultConfig
initialVty <- buildVty
void $ customMain initialVty buildVty (Just chan) theApp initialState

View File

@ -11,6 +11,8 @@ import Data.Monoid ((<>))
#endif
import qualified Graphics.Vty as V
import Graphics.Vty.CrossPlatform (mkVty)
import Brick
import Brick.Forms
( Form
@ -136,7 +138,7 @@ app =
main :: IO ()
main = do
let buildVty = do
v <- V.mkVty =<< V.standardIOConfig
v <- mkVty V.defaultConfig
V.setMode (V.outputIface v) V.Mouse True
return v

View File

@ -16,6 +16,7 @@ import Brick
import Brick.BChan
import Brick.Widgets.Border
import qualified Graphics.Vty as V
import Graphics.Vty.CrossPlatform (mkVty)
data AppState =
AppState { _textAreaHeight :: Int
@ -142,11 +143,10 @@ randomVal as = do
main :: IO ()
main = do
cfg <- V.standardIOConfig
vty <- V.mkVty cfg
vty <- mkVty V.defaultConfig
chan <- newBChan 10
-- Run thread to simulate incoming data
void $ forkIO $ generateLines chan
void $ customMain vty (V.mkVty cfg) (Just chan) app initialState
void $ customMain vty (mkVty V.defaultConfig) (Just chan) app initialState

View File

@ -10,6 +10,7 @@ import Control.Monad (void)
import Data.Monoid ((<>))
#endif
import qualified Graphics.Vty as V
import Graphics.Vty.CrossPlatform (mkVty)
import qualified Brick.Types as T
import qualified Brick.Main as M
@ -147,7 +148,7 @@ app =
main :: IO ()
main = do
let buildVty = do
v <- V.mkVty =<< V.standardIOConfig
v <- mkVty V.defaultConfig
V.setMode (V.outputIface v) V.Mouse True
return v

View File

@ -73,11 +73,11 @@ import Graphics.Vty
, displayBounds
, shutdown
, nextEvent
, mkVty
, defaultConfig
, restoreInputState
, inputIface
)
import Graphics.Vty.CrossPlatform (mkVty)
import Graphics.Vty.Config (defaultConfig)
import Graphics.Vty.Attributes (defAttr)
import Brick.BChan (BChan, newBChan, readBChan, readBChan2, writeBChan)