packages feed

vty 5.8.1 → 5.9

raw patch · 6 files changed

+50/−1 lines, 6 filesdep ~microlensnew-component:exe:vty-bell-demo

Dependency ranges changed: microlens

Files

CHANGELOG view
@@ -1,3 +1,7 @@+5.9+  - Added new Output methods supportsBell and ringTerminalBell to find out+    whether the output device has an audio bell and to ring it (see #102)+ 5.8.1   - Fixed "refresh" to work as advertised (see #104) 
src/Graphics/Vty/Output/Interface.hs view
@@ -83,6 +83,10 @@     -- Currently all regions have the upper left corner of (0,0) and the lower right corner at      -- (max displayWidth providedWidth, max displayHeight providedHeight)     , mkDisplayContext :: forall m. MonadIO m => Output -> DisplayRegion -> m DisplayContext+    -- | Ring the terminal bell if supported.+    , ringTerminalBell :: forall m. MonadIO m => m ()+    -- | Returns whether the terminal has an audio bell feature.+    , supportsBell :: forall m. MonadIO m => m Bool     }  displayContext :: MonadIO m => Output -> DisplayRegion -> m DisplayContext
src/Graphics/Vty/Output/Mock.hs view
@@ -41,6 +41,8 @@             , releaseTerminal = return ()             , reserveDisplay = return ()             , releaseDisplay = return ()+            , ringTerminalBell = return ()+            , supportsBell = return False             , displayBounds = return r             , outputByteBuffer = \bytes -> do                 putStrLn $ "mock outputByteBuffer of " ++ show (BS.length bytes) ++ " bytes"
src/Graphics/Vty/Output/TerminfoBased.hs view
@@ -64,6 +64,7 @@     , clearScreen :: CapExpression     , clearEol :: CapExpression     , displayAttrCaps :: DisplayAttrCaps+    , ringBellAudio :: Maybe CapExpression     }  data DisplayAttrCaps = DisplayAttrCaps@@ -140,12 +141,15 @@         <*> requireCap ti "clear"         <*> requireCap ti "el"         <*> currentDisplayAttrCaps ti+        <*> probeCap ti "bel"     newAssumedStateRef <- newIORef initialAssumedState     let t = Output             { terminalID = termName             , releaseTerminal = liftIO $ do                 sendCap setDefaultAttr []                 maybeSendCap cnorm []+            , supportsBell = return $ isJust $ ringBellAudio terminfoCaps+            , ringTerminalBell = liftIO $ maybeSendCap ringBellAudio []             , reserveDisplay = liftIO $ do                 -- If there is no support for smcup: Clear the screen and then move the mouse to the                 -- home position to approximate the behavior.
+ test.hs view
@@ -0,0 +1,20 @@+import Control.Exception (bracket)+import Graphics.Vty++main :: IO ()+main =+  bracket (mkVty mempty) shutdown $ \vty ->+    do a <- supportsBell (outputIface vty)+       update vty (picForImage (string defAttr $ show a))+       loop vty ++loop :: Vty -> IO ()+loop vty =+  do ev <- nextEvent vty +     case ev of+       EvKey KEsc        _ -> return ()+       EvKey (KChar 'p') _ -> putStrLn "bad news" >> loop vty +       EvKey (KChar 'l') _ -> refresh vty         >> loop vty+       EvKey (KChar 'b') _ -> ringTerminalBell (outputIface vty) >> loop vty+       _                   -> loop vty+
vty.cabal view
@@ -1,5 +1,5 @@ name:                vty-version:             5.8.1+version:             5.9 license:             BSD3 license-file:        LICENSE author:              AUTHORS@@ -128,6 +128,21 @@   ghc-prof-options:    -O2 -funbox-strict-fields -caf-all -Wall -fspec-constr -fspec-constr-count=10    cc-options:          -O2++executable vty-bell-demo+  main-is:             test.hs++  default-language:    Haskell2010+  default-extensions:  ScopedTypeVariables+  ghc-options:         -threaded++  build-depends:       vty,+                       base >= 4 && < 5,+                       containers,+                       data-default >= 0.5.3,+                       microlens,+                       microlens-mtl,+                       mtl >= 1.1.1.0 && < 2.3  executable vty-mode-demo   main-is:             ModeDemo.hs