packages feed

rasa-ext-slate 0.1.7 → 0.1.8

raw patch · 5 files changed

+20/−19 lines, 5 filesdep ~rasadep ~rasa-ext-loggerdep ~rasa-ext-views

Dependency ranges changed: rasa, rasa-ext-logger, rasa-ext-views

Files

rasa-ext-slate.cabal view
@@ -1,5 +1,5 @@ name: rasa-ext-slate-version: 0.1.7+version: 0.1.8 cabal-version: >=1.10 build-type: Simple license: GPL-3@@ -26,15 +26,15 @@         Rasa.Ext.Slate.Internal.Attributes     build-depends:         base >=4.8 && <5,-        rasa >=0.1.10 && <0.2,-        rasa-ext-views >=0.1.4 && <0.2,+        rasa >=0.1.11 && <0.2,+        rasa-ext-views >=0.1.5 && <0.2,         recursion-schemes >=5.0.1 && <5.1,         text >=1.2.2.1 && <1.3,         mtl >=2.2.1 && <2.3,         yi-rope >=0.7.0.2 && <0.8,         lens ==4.14.*,         vty ==5.14.*,-        rasa-ext-logger >=0.1.3 && <0.2+        rasa-ext-logger >=0.1.4 && <0.2     default-language: Haskell2010     hs-source-dirs: src     ghc-options: -Wall
src/Rasa/Ext/Slate.hs view
@@ -15,14 +15,14 @@ -- > rasa $ do -- >    slate -- >    ...-slate :: Action ()+slate :: App () slate = do-  onInit terminalEvents+  terminalEvents   onEveryRender_ renderAll   onExit shutdown  -- | Call vty shutdown procedure (if this doesn't happen the terminal ends up in strange states)-shutdown :: Action ()+shutdown :: App () shutdown = do   v <- getVty   liftIO $ V.shutdown v
src/Rasa/Ext/Slate/Internal/Event.hs view
@@ -8,7 +8,7 @@ import qualified Graphics.Vty as V  -- | Provides keypress events from the terminal, converted from Vty events.-terminalEvents :: Action ()+terminalEvents :: App () terminalEvents = do     v <- getVty     asyncActionProvider $ getEvents v
src/Rasa/Ext/Slate/Internal/Render.hs view
@@ -20,13 +20,13 @@ import Control.Monad.IO.Class  -- | Get the current terminal size.-getSize :: Action (Width, Height)+getSize :: App (Width, Height) getSize = do   v <- getVty   liftIO $ V.displayBounds $ V.outputIface v  -- | Render the Editor-renderAll :: Action ()+renderAll :: App () renderAll = do   (width, height) <- getSize   mViews <- getViews@@ -56,7 +56,7 @@     end = min sz amt  -- | Recursively render components of a Window to a 'V.Image' combining the results in the proper locations.-renderWindow :: BiTree Split View -> Width -> Height -> Action V.Image+renderWindow :: BiTree Split View -> Width -> Height -> App V.Image renderWindow = cata alg   where     mkBorder = V.charFill (V.defAttr `V.withForeColor` V.green)@@ -88,7 +88,7 @@ type Right = V.Image  -- | Renders widgets to images-widgetsToImages :: Width -> Height -> ScrollPos -> Widgets -> Action (Top, Bottom, Left, Right)+widgetsToImages :: Width -> Height -> ScrollPos -> Widgets -> App (Top, Bottom, Left, Right) widgetsToImages width height scrollAmt widgets = do   top <- renderHorBar width (widgets^.topBar)   bottom <- renderHorBar width (widgets^.bottomBar)@@ -101,7 +101,7 @@       renderVertBar h rs = V.resizeHeight h . V.horizCat <$> traverse (renderToImage 1 h scrollAmt) rs  -- | Render a given 'View' to a 'V.Image' given the context of the associated buffer and a size to render it in.-renderView :: Width -> Height -> View -> Action V.Image+renderView :: Width -> Height -> View -> App V.Image renderView width height vw = do   widgets <- computeWidgets vw   (top, bottom, left, right)  <- widgetsToImages width height scrollAmt widgets@@ -112,5 +112,5 @@   where     scrollAmt = vw^.scrollPos -renderToImage :: Renderable r => Width -> Height -> ScrollPos -> r -> Action V.Image+renderToImage :: Renderable r => Width -> Height -> ScrollPos -> r -> App V.Image renderToImage w h scroll r = maybe V.emptyImage applyAttrs <$> render w h scroll r
src/Rasa/Ext/Slate/Internal/State.hs view
@@ -2,7 +2,8 @@  import Rasa.Ext -import Control.Monad.IO.Class+import Control.Lens+import Control.Monad.Trans import qualified Graphics.Vty as V  -- | Store 'V.Vty' state globally@@ -11,17 +12,17 @@   show _ = "Slate"  -- | V.Vty must be initialized, this takes IO to perform.-initUi :: Action V.Vty+initUi :: App V.Vty initUi = do   cfg <- liftIO V.standardIOConfig   v <- liftIO $ V.mkVty cfg-  setExt $ Just (Slate v)+  stateLens .= Just (Slate v)   return v  -- | Gets vty by checking if it has been initialized yet, if not it runs the initialization.-getVty :: Action V.Vty+getVty :: App V.Vty getVty = do-  v <- getExt+  v <- use stateLens   case v of     Just (Slate v') -> return v'     Nothing -> initUi