yi-frontend-vty 0.19.0 → 0.19.1
raw patch · 2 files changed
+60/−5 lines, 2 filesdep +vty-crossplatformdep ~vtynew-uploaderPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: vty-crossplatform
Dependency ranges changed: vty
API changes (from Hackage documentation)
- Yi.Frontend.Vty: baseVtyConfig :: Lens' Config (Maybe Config)
+ Yi.Frontend.Vty: baseVtyConfig :: Lens' Config (Maybe VtyUserConfig)
Files
- src/Yi/Frontend/Vty.hs +47/−3
- yi-frontend-vty.cabal +13/−2
src/Yi/Frontend/Vty.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE OverloadedStrings #-}@@ -45,9 +46,30 @@ unpack) import Data.Typeable (Typeable) import GHC.Conc (labelThread)+#if MIN_VERSION_vty(6,0,0)+import qualified Graphics.Vty.CrossPlatform as Vty (mkVty) import qualified Graphics.Vty as Vty (Attr, Cursor (Cursor, NoCursor),+ VtyUserConfig,+ Image,+ Input (eventChannel),+ Output (displayBounds),+ Picture (picCursor), Vty (inputIface, outputIface, refresh, shutdown, update),+ bold, char, charFill,+ defaultConfig,+ defAttr, emptyImage,+ horizCat,+ picForLayers,+ string,+ reverseVideo, text',+ translate, underline,+ userConfig,+ vertCat, withBackColor,+ withForeColor,+ withStyle, (<|>))+#else+import qualified Graphics.Vty as Vty (Attr, Cursor (Cursor, NoCursor), Config,- Event (EvResize), Image,+ Image, Input (_eventChannel), Output (displayBounds), Picture (picCursor), Vty (inputIface, outputIface, refresh, shutdown, update),@@ -62,6 +84,8 @@ vertCat, withBackColor, withForeColor, withStyle, (<|>))+#endif+import qualified Graphics.Vty.Input.Events as VtyIE (InternalEvent(..), Event (EvResize)) import System.Exit (ExitCode, exitWith) import Yi.Buffer import Yi.Config@@ -102,23 +126,36 @@ -- If this is set to its default (None) it will be replaced by the default -- vty configuration from standardIOConfig. However, standardIOConfig -- runs in the IO monad so we cannot set the real default here.+#if MIN_VERSION_vty(6,0,0)+newtype BaseVtyConfig = BaseVtyConfig { _baseVtyConfig' :: Maybe Vty.VtyUserConfig }+#else newtype BaseVtyConfig = BaseVtyConfig { _baseVtyConfig' :: Maybe Vty.Config }+#endif deriving (Typeable, Default) instance YiConfigVariable BaseVtyConfig makeLenses ''BaseVtyConfig +#if MIN_VERSION_vty(6,0,0)+baseVtyConfig :: Lens' Config (Maybe Vty.VtyUserConfig)+#else baseVtyConfig :: Lens' Config (Maybe Vty.Config)+#endif baseVtyConfig = configVariable . baseVtyConfig' start :: UIBoot start config submitEvents submitActions editor = do let baseConfig = view baseVtyConfig config+#if MIN_VERSION_vty(6,0,0)+ vty <- Vty.mkVty . (<> fromMaybe Vty.defaultConfig baseConfig) =<< Vty.userConfig+ let inputChan = Vty.eventChannel (Vty.inputIface vty)+#else vty <- Vty.mkVty =<< case baseConfig of Nothing -> Vty.standardIOConfig Just conf -> return conf let inputChan = Vty._eventChannel (Vty.inputIface vty)+#endif endInput <- newEmptyMVar endMain <- newEmptyMVar endRender <- newEmptyMVar@@ -143,10 +180,17 @@ getEvent = do event <- atomically (readTChan inputChan) case event of- (Vty.EvResize _ _) -> do+ (VtyIE.InputEvent (VtyIE.EvResize _ _)) -> do submitActions [] getEvent- _ -> return (fromVtyEvent event)+ (VtyIE.InputEvent ev) -> return (fromVtyEvent ev)+#if MIN_VERSION_vty(6,0,0)+ VtyIE.ResumeAfterInterrupt -> do+#else+ VtyIE.ResumeAfterSignal -> do+#endif+ Vty.refresh vty+ getEvent renderLoop :: IO () renderLoop = do
yi-frontend-vty.cabal view
@@ -1,5 +1,5 @@ name: yi-frontend-vty-version: 0.19.0+version: 0.19.1 synopsis: Vty frontend for Yi editor category: Yi homepage: https://github.com/yi-editor/yi#readme@@ -13,6 +13,11 @@ type: git location: https://github.com/yi-editor/yi +flag old-vty+ description: Build against a pre-6.0 version of the vty package.+ default: False+ manual: False+ library hs-source-dirs: src@@ -26,10 +31,16 @@ , pointedlist , stm >= 2.2 , text- , vty >= 5.4 , yi-core >= 0.19 , yi-language >= 0.19 , yi-rope >= 0.10+ if flag(old-vty)+ build-depends:+ vty >= 5.4 && < 6+ else+ build-depends:+ vty >= 6+ , vty-crossplatform exposed-modules: Yi.Config.Default.Vty Yi.Frontend.Vty