on master help sign in
Output: add supportsItalics and supportsStrikethrough to check for feature support
bcbf7faJonathan Daugherty
src/Graphics/Vty/Output/Interface.hs+4
@@ -101,6 +101,10 @@ data Output = Output
101 , ringTerminalBell :: IO ()
101 , ringTerminalBell :: IO ()
102 -- | Returns whether the terminal has an audio bell feature.
102 -- | Returns whether the terminal has an audio bell feature.
103 , supportsBell :: IO Bool
103 , supportsBell :: IO Bool
104+ -- | Returns whether the terminal supports italicized text.
105+ , supportsItalics :: IO Bool
106+ -- | Returns whether the terminal supports strikethrough text.
107+ , supportsStrikethrough :: IO Bool
104 }
108 }
105
109
106displayContext :: Output -> DisplayRegion -> IO DisplayContext
110displayContext :: Output -> DisplayRegion -> IO DisplayContext
src/Graphics/Vty/Output/Mock.hs+2
@@ -48,6 +48,8 @@ mockTerminal r = liftIO $ do
48 , releaseDisplay = return ()
48 , releaseDisplay = return ()
49 , ringTerminalBell = return ()
49 , ringTerminalBell = return ()
50 , supportsBell = return False
50 , supportsBell = return False
51+ , supportsItalics = return False
52+ , supportsStrikethrough = return False
51 , setDisplayBounds = const $ return ()
53 , setDisplayBounds = const $ return ()
52 , displayBounds = return r
54 , displayBounds = return r
53 , outputByteBuffer = \bytes -> do
55 , outputByteBuffer = \bytes -> do
src/Graphics/Vty/Output/TerminfoBased.hs+4
@@ -168,6 +168,10 @@ reserveTerminal termName outFd = do
168 sendCap setDefaultAttr []
168 sendCap setDefaultAttr []
169 maybeSendCap cnorm []
169 maybeSendCap cnorm []
170 , supportsBell = return $ isJust $ ringBellAudio terminfoCaps
170 , supportsBell = return $ isJust $ ringBellAudio terminfoCaps
171+ , supportsItalics = return $ (isJust $ enterItalic (displayAttrCaps terminfoCaps)) &&
172+ (isJust $ exitItalic (displayAttrCaps terminfoCaps))
173+ , supportsStrikethrough = return $ (isJust $ enterStrikethrough (displayAttrCaps terminfoCaps)) &&
174+ (isJust $ exitStrikethrough (displayAttrCaps terminfoCaps))
171 , ringTerminalBell = maybeSendCap ringBellAudio []
175 , ringTerminalBell = maybeSendCap ringBellAudio []
172 , reserveDisplay = do
176 , reserveDisplay = do
173 -- If there is no support for smcup: Clear the screen
177 -- If there is no support for smcup: Clear the screen