Hello community, here is the log from the commit of package ghc-vty for openSUSE:Factory checked in at 2020-07-21 15:50:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-vty (Old) and /work/SRC/openSUSE:Factory/.ghc-vty.new.3592 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-vty" Tue Jul 21 15:50:34 2020 rev:2 rq:822047 version:5.30 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-vty/ghc-vty.changes 2020-06-19 17:05:31.312843735 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-vty.new.3592/ghc-vty.changes 2020-07-21 15:53:24.824516794 +0200 @@ -1,0 +2,36 @@ +Thu Jul 16 02:00:26 UTC 2020 - [email protected] + +- Update vty to version 5.30. + 5.30 + ---- + + New features: + * Added `Graphics.Vty.setWindowTitle` to emit an escape + sequence to set the window title, provide the terminal emulator + accepts Xterm-style title sequences. For details, see: + https://tldp.org/HOWTO/Xterm-Title-3.html + +------------------------------------------------------------------- +Fri Jul 10 02:00:23 UTC 2020 - [email protected] + +- Update vty to version 5.29. + 5.29 + ---- + + API changes: + * The Input type got a new field, 'restoreInputState'. This field + allows the end user to have direct access to the logic needed to + restore the terminal's input state flags. Prior to having this field, + this state restoration logic could only be invoked as part of calling + 'shutdownInput', but since that function does other things (like + killing threads) it is not advisable to call it repeatedly (which is + necessary in the use case this change is intended to support). This + can be called directly to restore the input state flags as needed, + although this is not required if 'shutdown' (or 'shutdownInput') is + called. + + Other changes: + * attributeControl: explicitly enable the ICRNL terminal mode flag (see + #187 and c572ad). + +------------------------------------------------------------------- Old: ---- vty-5.28.2.tar.gz New: ---- vty-5.30.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-vty.spec ++++++ --- /var/tmp/diff_new_pack.e1iIup/_old 2020-07-21 15:53:26.756519143 +0200 +++ /var/tmp/diff_new_pack.e1iIup/_new 2020-07-21 15:53:26.760519148 +0200 @@ -19,7 +19,7 @@ %global pkg_name vty %bcond_with tests Name: ghc-%{pkg_name} -Version: 5.28.2 +Version: 5.30 Release: 0 Summary: A simple terminal UI library License: BSD-3-Clause ++++++ vty-5.28.2.tar.gz -> vty-5.30.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vty-5.28.2/CHANGELOG.md new/vty-5.30/CHANGELOG.md --- old/vty-5.28.2/CHANGELOG.md 2001-09-09 03:46:40.000000000 +0200 +++ new/vty-5.30/CHANGELOG.md 2001-09-09 03:46:40.000000000 +0200 @@ -1,4 +1,32 @@ +5.30 +---- + +New features: + * Added `Graphics.Vty.setWindowTitle` to emit an escape + sequence to set the window title, provide the terminal emulator + accepts Xterm-style title sequences. For details, see: + https://tldp.org/HOWTO/Xterm-Title-3.html + +5.29 +---- + +API changes: + * The Input type got a new field, 'restoreInputState'. This field + allows the end user to have direct access to the logic needed to + restore the terminal's input state flags. Prior to having this field, + this state restoration logic could only be invoked as part of calling + 'shutdownInput', but since that function does other things (like + killing threads) it is not advisable to call it repeatedly (which is + necessary in the use case this change is intended to support). This + can be called directly to restore the input state flags as needed, + although this is not required if 'shutdown' (or 'shutdownInput') is + called. + +Other changes: + * attributeControl: explicitly enable the ICRNL terminal mode flag (see + #187 and c572ad). + 5.28.2 ------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vty-5.28.2/src/Graphics/Vty/Image.hs new/vty-5.30/src/Graphics/Vty/Image.hs --- old/vty-5.28.2/src/Graphics/Vty/Image.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/vty-5.30/src/Graphics/Vty/Image.hs 2001-09-09 03:46:40.000000000 +0200 @@ -117,14 +117,16 @@ vertCat :: [Image] -> Image vertCat = foldr vertJoin EmptyImage --- | Make an 'Image' from a lazy text value. This function should not be --- given a text value containing escapes. +-- | Make an 'Image' from a lazy text value. The text value should be +-- sanitized of escape sequences (ASCII 27) and carriage returns; +-- otherwise layout and attribute problems may result. text :: Attr -> TL.Text -> Image text a txt = let displayWidth = safeWctlwidth txt in HorizText a txt displayWidth (fromIntegral $! TL.length txt) --- | Make an 'Image' from a text value. This function should not be --- given a text value containing escapes. +-- | Make an 'Image' from a text value. The text value should be +-- sanitized of escape sequences (ASCII 27) and carriage returns; +-- otherwise layout and attribute problems may result. text' :: Attr -> T.Text -> Image text' a txt = let displayWidth = safeWctwidth txt in HorizText a (TL.fromStrict txt) displayWidth (T.length txt) @@ -138,8 +140,9 @@ -- | Make an image from a string of characters layed out on a single -- row with the same display attribute. The string is assumed to be a --- sequence of ISO-10646 characters. This function should not be given a --- string containing escapes. +-- sequence of ISO-10646 characters. The input string should be +-- sanitized of escape sequences (ASCII 27) and carriage returns; +-- otherwise layout and attribute problems may result. -- -- Note: depending on how the Haskell compiler represents string -- literals, a string literal in a UTF-8 encoded source file, for @@ -156,8 +159,7 @@ -- -- This is an alias for iso10646String since the usual case is that a -- literal string like "foo" is represented internally as a list of ISO --- 10646 31 bit characters. This function should not be given a string --- containing escapes. +-- 10646 31 bit characters. -- -- Note: Keep in mind that GHC will compile source encoded as UTF-8 -- but the literal strings, while UTF-8 encoded in the source, will be diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vty-5.28.2/src/Graphics/Vty/Input/Loop.hs new/vty-5.30/src/Graphics/Vty/Input/Loop.hs --- old/vty-5.28.2/src/Graphics/Vty/Input/Loop.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/vty-5.30/src/Graphics/Vty/Input/Loop.hs 2001-09-09 03:46:40.000000000 +0200 @@ -52,9 +52,14 @@ -- 'nextEvent' this will not refresh the display if the next event -- is an 'EvResize'. _eventChannel :: TChan Event - -- | Shuts down the input processing. This should return the - -- terminal input state to before he input initialized. + -- | Shuts down the input processing. As part of shutting down the + -- input, this should also restore the input state. , shutdownInput :: IO () + -- | Restore the terminal's input state to what it was prior + -- to configuring input for Vty. This should be done as part of + -- 'shutdownInput' but is exposed in case you need to access it + -- directly. + , restoreInputState :: IO () -- | Changes to this value are reflected after the next event. , _configRef :: IORef Config -- | input debug log @@ -171,15 +176,47 @@ <*> pure (classify classifyTable) runReaderT (evalStateT loopInputProcessor s0) input +-- | Construct two IO actions: one to configure the terminal for Vty and +-- one to restore the terminal mode flags to the values they had at the +-- time this function was called. +-- +-- This function constructs a configuration action to clear the +-- following terminal mode flags: +-- +-- * IXON disabled: disables software flow control on outgoing data. +-- This stops the process from being suspended if the output terminal +-- cannot keep up. +-- +-- * Raw mode is used for input. +-- +-- * ISIG (enables keyboard combinations that result in +-- signals) +-- +-- * ECHO (input is not echoed to the output) +-- +-- * ICANON (canonical mode (line mode) input is not used) +-- +-- * IEXTEN (extended functions are disabled) +-- +-- The configuration action also explicitly sets these flags: +-- +-- * ICRNL (input carriage returns are mapped to newlines) attributeControl :: Fd -> IO (IO (), IO ()) attributeControl fd = do original <- getTerminalAttributes fd - let vtyMode = foldl withoutMode original [ StartStopOutput, KeyboardInterrupts - , EnableEcho, ProcessInput, ExtendedFunctions - ] + let vtyMode = foldl withMode clearedFlags flagsToSet + clearedFlags = foldl withoutMode original flagsToUnset + flagsToSet = [ MapCRtoLF -- ICRNL + ] + flagsToUnset = [ StartStopOutput -- IXON + , KeyboardInterrupts -- ISIG + , EnableEcho -- ECHO + , ProcessInput -- ICANON + , ExtendedFunctions -- IEXTEN + ] let setAttrs = setTerminalAttributes fd vtyMode Immediately unsetAttrs = setTerminalAttributes fd original Immediately - return (setAttrs,unsetAttrs) + return (setAttrs, unsetAttrs) logInitialInputState :: Input -> ClassifyMap -> IO() logInitialInputState input classifyTable = case _inputDebug input of @@ -204,6 +241,7 @@ stopSync <- newEmptyMVar input <- Input <$> atomically newTChan <*> pure (return ()) + <*> pure (return ()) <*> newIORef config <*> maybe (return Nothing) (\f -> Just <$> openFile f AppendMode) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vty-5.28.2/src/Graphics/Vty/Input.hs new/vty-5.30/src/Graphics/Vty/Input.hs --- old/vty-5.28.2/src/Graphics/Vty/Input.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/vty-5.30/src/Graphics/Vty/Input.hs 2001-09-09 03:46:40.000000000 +0200 @@ -143,22 +143,8 @@ -- bytes comes from 'classifyMapForTerm' which is then overridden by -- the the applicable entries from the configuration's 'inputMap'. -- --- The terminal device is configured with the attributes: --- --- * IXON disabled: disables software flow control on outgoing data. --- This stops the process from being suspended if the output terminal --- cannot keep up. --- --- * Raw mode is used for input. --- --- * ISIG disabled (enables keyboard combinations that result in --- signals) --- --- * ECHO disabled (input is not echoed to the output) --- --- * ICANON disabled (canonical mode (line mode) input is not used) --- --- * IEXTEN disabled (extended functions are disabled) +-- The terminal device's mode flags are configured by the +-- 'attributeControl' function. inputForConfig :: Config -> IO Input inputForConfig config@Config{ termName = Just termName , inputFd = Just termFd @@ -168,7 +154,7 @@ terminal <- Terminfo.setupTerm termName let inputOverrides = [(s,e) | (t,s,e) <- inputMap, t == Nothing || t == Just termName] activeInputMap = classifyMapForTerm termName terminal `mappend` inputOverrides - (setAttrs,unsetAttrs) <- attributeControl termFd + (setAttrs, unsetAttrs) <- attributeControl termFd setAttrs input <- initInput config activeInputMap let pokeIO = Catch $ do @@ -177,11 +163,15 @@ atomically $ writeTChan (input^.eventChannel) (EvResize e e) _ <- installHandler windowChange pokeIO Nothing _ <- installHandler continueProcess pokeIO Nothing + + let restore = unsetAttrs + return $ input { shutdownInput = do shutdownInput input _ <- installHandler windowChange Ignore Nothing _ <- installHandler continueProcess Ignore Nothing - unsetAttrs + restore + , restoreInputState = restoreInputState input >> restore } inputForConfig config = (<> config) <$> standardIOConfig >>= inputForConfig diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vty-5.28.2/src/Graphics/Vty.hs new/vty-5.30/src/Graphics/Vty.hs --- old/vty-5.28.2/src/Graphics/Vty.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/vty-5.30/src/Graphics/Vty.hs 2001-09-09 03:46:40.000000000 +0200 @@ -33,6 +33,7 @@ module Graphics.Vty ( Vty(..) , mkVty + , setWindowTitle , Mode(..) , module Graphics.Vty.Config , module Graphics.Vty.Input @@ -54,6 +55,9 @@ import Graphics.Vty.UnicodeWidthTable.IO import Graphics.Vty.UnicodeWidthTable.Install +import Data.Char (isPrint, showLitChar) +import qualified Data.ByteString.Char8 as BS8 + import qualified Control.Exception as E import Control.Monad (when) import Control.Concurrent.STM @@ -224,3 +228,24 @@ , shutdown = shutdownIo , isShutdown = shutdownStatus } + +-- | Set the terminal window title string. +-- +-- This function emits an Xterm-compatible escape sequence that we +-- anticipate will work for essentially all modern terminal emulators. +-- Ideally we'd use a terminal capability for this, but there does not +-- seem to exist a termcap for setting window titles. If you find that +-- this function does not work for a given terminal emulator, please +-- report the issue. +-- +-- For details, see: +-- +-- https://tldp.org/HOWTO/Xterm-Title-3.html +setWindowTitle :: Vty -> String -> IO () +setWindowTitle vty title = do + let sanitize :: String -> String + sanitize = concatMap sanitizeChar + sanitizeChar c | not (isPrint c) = showLitChar c "" + | otherwise = [c] + let buf = BS8.pack $ "\ESC]2;" <> sanitize title <> "\007" + outputByteBuffer (outputIface vty) buf diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vty-5.28.2/vty.cabal new/vty-5.30/vty.cabal --- old/vty-5.28.2/vty.cabal 2001-09-09 03:46:40.000000000 +0200 +++ new/vty-5.30/vty.cabal 2001-09-09 03:46:40.000000000 +0200 @@ -1,5 +1,5 @@ name: vty -version: 5.28.2 +version: 5.30 license: BSD3 license-file: LICENSE author: AUTHORS
