mirror of
https://github.com/ilyakooo0/vty.git
synced 2024-11-25 19:22:08 +03:00
Output: add supportsItalics and supportsStrikethrough to check for feature support
This commit is contained in:
parent
63adf9e4db
commit
bcbf7fabc1
@ -101,6 +101,10 @@ data Output = Output
|
||||
, ringTerminalBell :: IO ()
|
||||
-- | Returns whether the terminal has an audio bell feature.
|
||||
, supportsBell :: IO Bool
|
||||
-- | Returns whether the terminal supports italicized text.
|
||||
, supportsItalics :: IO Bool
|
||||
-- | Returns whether the terminal supports strikethrough text.
|
||||
, supportsStrikethrough :: IO Bool
|
||||
}
|
||||
|
||||
displayContext :: Output -> DisplayRegion -> IO DisplayContext
|
||||
|
@ -48,6 +48,8 @@ mockTerminal r = liftIO $ do
|
||||
, releaseDisplay = return ()
|
||||
, ringTerminalBell = return ()
|
||||
, supportsBell = return False
|
||||
, supportsItalics = return False
|
||||
, supportsStrikethrough = return False
|
||||
, setDisplayBounds = const $ return ()
|
||||
, displayBounds = return r
|
||||
, outputByteBuffer = \bytes -> do
|
||||
|
@ -168,6 +168,10 @@ reserveTerminal termName outFd = do
|
||||
sendCap setDefaultAttr []
|
||||
maybeSendCap cnorm []
|
||||
, supportsBell = return $ isJust $ ringBellAudio terminfoCaps
|
||||
, supportsItalics = return $ (isJust $ enterItalic (displayAttrCaps terminfoCaps)) &&
|
||||
(isJust $ exitItalic (displayAttrCaps terminfoCaps))
|
||||
, supportsStrikethrough = return $ (isJust $ enterStrikethrough (displayAttrCaps terminfoCaps)) &&
|
||||
(isJust $ exitStrikethrough (displayAttrCaps terminfoCaps))
|
||||
, ringTerminalBell = maybeSendCap ringBellAudio []
|
||||
, reserveDisplay = do
|
||||
-- If there is no support for smcup: Clear the screen
|
||||
|
Loading…
Reference in New Issue
Block a user