vty-windows 0.1.0.2 → 0.1.0.3
raw patch · 4 files changed
+59/−54 lines, 4 filesdep ~blaze-builderdep ~bytestringdep ~containers
Dependency ranges changed: blaze-builder, bytestring, containers, deepseq, directory, filepath, microlens, microlens-mtl, microlens-th, mtl, parsec, stm, transformers, utf8-string, vector
Files
- CHANGELOG.md +10/−1
- src/Graphics/Vty/Platform/Windows/Output/TerminfoBased.hs +11/−13
- src/Graphics/Vty/Platform/Windows/WindowsCapabilities.hs +17/−23
- vty-windows.cabal +21/−17
CHANGELOG.md view
@@ -10,4 +10,13 @@ 0.1.0.2 ------- -Bug fix: Attribute resetting escape sequence was incorrect.+Bug fix: Attribute resetting escape sequence was incorrect. + +0.1.0.3 +------- +Bug fixes: + * Fixed the sgr capability sequence. + * Removed duplicate capability strings. + +Package changes: + * Removed unnecessary version bounds on dependencies.
src/Graphics/Vty/Platform/Windows/Output/TerminfoBased.hs view
@@ -28,7 +28,7 @@ import Data.IORef ( newIORef, readIORef, writeIORef ) import Data.Maybe (isJust, isNothing, fromJust) -import Data.Word +import Data.Word ( Word8 ) #if !MIN_VERSION_base(4,8,0) import Data.Foldable (foldMap) @@ -336,18 +336,18 @@ -- bytes. terminfoWriteSetAttr :: DisplayContext -> TerminfoCaps -> Bool -> FixedAttr -> Attr -> DisplayAttrDiff -> Write terminfoWriteSetAttr dc terminfoCaps urlsEnabled prevAttr reqAttr diffs = - urlAttrs urlsEnabled `mappend` case (foreColorDiff diffs == ColorToDefault) || (backColorDiff diffs == ColorToDefault) of + urlAttrs urlsEnabled `mappend` if (foreColorDiff diffs == ColorToDefault) || (backColorDiff diffs == ColorToDefault) -- The only way to reset either color, portably, to the default -- is to use either the set state capability or the set default -- capability. - True -> do + then case reqDisplayCapSeqFor (displayAttrCaps terminfoCaps) (fixedStyle attr) (styleToApplySeq $ fixedStyle attr) of -- only way to reset a color to the defaults EnterExitSeq caps -> writeDefaultAttr dc urlsEnabled `mappend` - foldMap (\cap -> writeCapExpr cap []) caps + foldMap (`writeCapExpr` []) caps `mappend` setColors -- implicitly resets the colors to the defaults @@ -360,7 +360,7 @@ `mappend` setColors -- Otherwise the display colors are not changing or changing -- between two non-default points. - False -> do + else -- Still, it could be the case that the change in display -- attributes requires the colors to be reset because the -- required capability was not available. @@ -373,7 +373,7 @@ -- ever reached! Changes the style and color states -- according to the differences with the currently -- applied states. - EnterExitSeq caps -> foldMap (\cap -> writeCapExpr cap []) caps + EnterExitSeq caps -> foldMap (`writeCapExpr` []) caps `mappend` writeColorDiff Foreground (foreColorDiff diffs) `mappend` @@ -389,9 +389,6 @@ where urlAttrs True = writeURLEscapes (urlDiff diffs) urlAttrs False = mempty - colorMap = if useAltColorMap terminfoCaps - then altColorIndex - else ansiColorIndex attr = fixDisplayAttr prevAttr reqAttr -- italics can't be set via SGR, so here we manually @@ -424,12 +421,13 @@ writeColor side (RGBColor r g b) = case outputColorMode (contextDevice dc) of - FullColor -> - hardcodeColor side (r, g, b) - _ -> - error "clampColor should remove rgb colors in standard mode" + FullColor -> hardcodeColor side (r, g, b) + _ -> error "clampColor should remove rgb colors in standard mode" writeColor side c = writeCapExpr (setSideColor side terminfoCaps) [toEnum $ colorMap c] + colorMap = if useAltColorMap terminfoCaps + then altColorIndex + else ansiColorIndex -- a color can either be in the foreground or the background data ColorSide = Foreground | Background
src/Graphics/Vty/Platform/Windows/WindowsCapabilities.hs view
@@ -27,37 +27,31 @@ -- https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences windowsStringCaps :: M.Map String String windowsStringCaps = M.fromList - [ ("bold", csi "1m") - , ("clear", csi "H" ++ csi "J") + [ ("sgr0", csi "0m") -- reset styles and colors + , ("bold", csi "1m") -- set bold style + , ("dim", csi "2m") -- set dim style + , ("sitm", csi "3m") -- set italic style + , ("smul", csi "4m") -- set underline style + , ("rev", csi "7m") -- set reverse video mode (reverse foreground/background colors) + , ("invis", csi "8m") -- set hidden text style + , ("smxx", csi "9m") -- set strike-through style + , ("ritm", csi "23m") -- exit italic mode + , ("rmul", csi "24m") -- exit underline mode + , ("rmso", csi "27m") -- exit reverse video mode + , ("rmxx", csi "29m") -- exit strikethrough mode + , ("clear", csi "H" ++ csi "J") -- move cursor to home row, then clear from cursor to end of screen (whole screen) , ("cup", csi "%i%p1%d;%p2%dH") , ("civis", csi "?25l") , ("cnorm", csi "34h" ++ csi "?25h") - , ("dim", csi "2m") + , ("home", csi "H") , ("ed", csi "J") , ("el", csi "K") - , ("home", csi "H") - , ("invis", csi "8m") , ("kbs", "^H") - , ("rev", csi "7m") - , ("rmso", csi "27m") - , ("rmul", csi "m") , ("setab", csi "%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m") , ("setaf", csi "%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m") - , ("sgr", csi "0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p7%t;8%;m%?%p9%t\SO%e\SI%;") - , ("sgr0", csi "0m") - , ("smso", csi "7m") - , ("rmcup", csi "?1049l") - , ("smcup", csi "?1049h") - , ("el", csi "K") - , ("sitm", csi "3m") - , ("ritm", csi "23m") - , ("smxx", csi "9m") - , ("rmxx", csi "29m") - , ("smul", csi "4m") - , ("rmul", csi "24m") - , ("rev", csi "7m") - , ("dim", csi "2m") - , ("bold", csi "1m") + , ("sgr", csi "0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p7%t;8%;m") + , ("smcup", csi "?1049h") -- switch to the alternate screen buffer + , ("rmcup", csi "?1049l") -- exit the alternate screen buffer ] windowsIntCaps :: M.Map String Int
vty-windows.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: vty-windows -version: 0.1.0.2 +version: 0.1.0.3 license: BSD-3-Clause license-file: LICENSE author: Chris hackett @@ -12,6 +12,10 @@ extra-doc-files: CHANGELOG.md extra-source-files: cbits/win_pseudo_console.c +source-repository head + type: git + location: https://github.com/chhackett/vty-windows + common warnings ghc-options: -Wall @@ -40,22 +44,22 @@ Graphics.Vty.Platform.Windows.WindowsConsoleInput Graphics.Vty.Platform.Windows.WindowsInterfaces build-depends: base >= 4.9.0.0 && < 5.0, - Win32 >= 2.8.5.0 && < 3.0, - bytestring >= 0.11.4 && < 1.0, - deepseq >= 1.4.2 && < 2.0, - filepath >= 1.4.2 && < 2.0, - blaze-builder >= 0.4.2 && < 1.0, - containers >= 0.5.7 && < 1.0, - directory >= 1.3.7 && < 2.0, - microlens >= 0.4.13 && < 1.0, - microlens-mtl >= 0.2.0 && < 1.0, - mtl >= 2.2.2 && < 3.0, - transformers >= 0.5.6 && < 1.0, - microlens-th >= 0.4.3 && < 1.0, - parsec >= 3.1.16 && < 4.0, - stm >= 2.5.1 && < 3.0, - utf8-string >= 1.0.2 && < 2.0, - vector >= 0.13.0 && < 1.0, + blaze-builder, + bytestring, + containers, + deepseq, + directory, + filepath, + microlens, + microlens-mtl, + microlens-th, + mtl, + parsec, + stm, + transformers, + utf8-string, + vector, vty >= 6.0 && < 7.0, + Win32 >= 2.8.5.0 && < 3.0, hs-source-dirs: src default-language: Haskell2010