on master help sign in
Output: add supportsItalics and supportsStrikethrough to check for feature support
commitbcbf7fabc175353fc90e51c547bc2a4ffb24a39c authorJonathan Daugherty <cygnus@foobox.com> dateTue 13 Oct 2020, 08:52 (6 years ago) parent63adf9e
3 files changed+10
src/Graphics/Vty/Output/Interface.hs+4 src/Graphics/Vty/Output/Mock.hs+2 src/Graphics/Vty/Output/TerminfoBased.hs+4
src/Graphics/Vty/Output/Interface.hs+4
@@ -101,6 +101,10 @@ data Output = Output
101101 , ringTerminalBell :: IO ()
102102 -- | Returns whether the terminal has an audio bell feature.
103103 , 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
104108 }
105109
106110displayContext :: Output -> DisplayRegion -> IO DisplayContext
src/Graphics/Vty/Output/Mock.hs+2
@@ -48,6 +48,8 @@ mockTerminal r = liftIO $ do
4848 , releaseDisplay = return ()
4949 , ringTerminalBell = return ()
5050 , supportsBell = return False
51+ , supportsItalics = return False
52+ , supportsStrikethrough = return False
5153 , setDisplayBounds = const $ return ()
5254 , displayBounds = return r
5355 , outputByteBuffer = \bytes -> do
src/Graphics/Vty/Output/TerminfoBased.hs+4
@@ -168,6 +168,10 @@ reserveTerminal termName outFd = do
168168 sendCap setDefaultAttr []
169169 maybeSendCap cnorm []
170170 , 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))
171175 , ringTerminalBell = maybeSendCap ringBellAudio []
172176 , reserveDisplay = do
173177 -- If there is no support for smcup: Clear the screen