Hello community,

here is the log from the commit of package ghc-ansi-terminal for 
openSUSE:Leap:15.2 checked in at 2020-02-19 18:37:35
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2/ghc-ansi-terminal (Old)
 and      /work/SRC/openSUSE:Leap:15.2/.ghc-ansi-terminal.new.26092 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-ansi-terminal"

Wed Feb 19 18:37:35 2020 rev:12 rq:771219 version:0.10.2

Changes:
--------
--- /work/SRC/openSUSE:Leap:15.2/ghc-ansi-terminal/ghc-ansi-terminal.changes    
2020-01-15 15:00:38.201754124 +0100
+++ 
/work/SRC/openSUSE:Leap:15.2/.ghc-ansi-terminal.new.26092/ghc-ansi-terminal.changes
 2020-02-19 18:37:36.297841862 +0100
@@ -1,0 +2,49 @@
+Thu Nov 21 03:01:38 UTC 2019 - [email protected]
+
+- Update ansi-terminal to version 0.10.2.
+  Version 0.10.2
+  --------------
+
+  * `hGetTerminalSize` now assumes a terminal is no bigger than 9,999 by 9,999
+    (previously, no bigger than 999 by 999).
+  * On Windows, fix a bug where emulated cursor movement functions differed 
from
+    Windows 10 (movement bounded by the current viewport).
+
+-------------------------------------------------------------------
+Fri Nov  8 16:13:11 UTC 2019 - Peter Simons <[email protected]>
+
+- Drop obsolete group attributes.
+
+-------------------------------------------------------------------
+Sun Oct  6 02:03:01 UTC 2019 - [email protected]
+
+- Update ansi-terminal to version 0.10.1.
+  Version 0.10.1
+  --------------
+
+  * Add `hGetCursorPosition` and `hGetTerminalSize`.
+  * On Unix-like operating systems, fix a bug where `getReportedCursorPosition`
+    could block indefinitely if no information was forthcoming on the console
+    input stream.
+  * Improvements to Haddock documentation.
+
+-------------------------------------------------------------------
+Fri Sep  6 06:39:58 UTC 2019 - [email protected]
+
+- Update ansi-terminal to version 0.10.
+  Upstream has edited the change log file since the last release in
+  a non-trivial way, i.e. they did more than just add a new entry
+  at the top. You can review the file at:
+  http://hackage.haskell.org/package/ansi-terminal-0.10/src/CHANGELOG.md
+
+-------------------------------------------------------------------
+Mon May 13 02:02:17 UTC 2019 - [email protected]
+
+- Update ansi-terminal to version 0.9.1.
+  Version 0.9.1
+  -------------
+
+  * Flag modules with GHC's 'Safe Haskell' language extensions (from GHC 
7.2.1).
+  * Improvements and corrections to Haddock documentation.
+
+-------------------------------------------------------------------

Old:
----
  ansi-terminal-0.9.tar.gz

New:
----
  ansi-terminal-0.10.2.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc-ansi-terminal.spec ++++++
--- /var/tmp/diff_new_pack.fcXIVD/_old  2020-02-19 18:37:36.653842607 +0100
+++ /var/tmp/diff_new_pack.fcXIVD/_new  2020-02-19 18:37:36.657842615 +0100
@@ -18,11 +18,10 @@
 
 %global pkg_name ansi-terminal
 Name:           ghc-%{pkg_name}
-Version:        0.9
+Version:        0.10.2
 Release:        0
 Summary:        Simple ANSI terminal support, with Windows compatibility
 License:        BSD-3-Clause
-Group:          Development/Libraries/Haskell
 URL:            https://hackage.haskell.org/package/%{pkg_name}
 Source0:        
https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz
 BuildRequires:  ghc-Cabal-devel
@@ -36,7 +35,6 @@
 
 %package devel
 Summary:        Haskell %{pkg_name} library development files
-Group:          Development/Libraries/Haskell
 Requires:       %{name} = %{version}-%{release}
 Requires:       ghc-compiler = %{ghc_version}
 Requires(post): ghc-compiler = %{ghc_version}

++++++ ansi-terminal-0.9.tar.gz -> ansi-terminal-0.10.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansi-terminal-0.9/CHANGELOG.md 
new/ansi-terminal-0.10.2/CHANGELOG.md
--- old/ansi-terminal-0.9/CHANGELOG.md  2019-01-26 20:56:34.000000000 +0100
+++ new/ansi-terminal-0.10.2/CHANGELOG.md       2019-11-21 00:13:27.000000000 
+0100
@@ -1,11 +1,42 @@
 Changes
 =======
 
+Version 0.10.2
+--------------
+
+* `hGetTerminalSize` now assumes a terminal is no bigger than 9,999 by 9,999
+  (previously, no bigger than 999 by 999).
+* On Windows, fix a bug where emulated cursor movement functions differed from
+  Windows 10 (movement bounded by the current viewport).
+
+Version 0.10.1
+--------------
+
+* Add `hGetCursorPosition` and `hGetTerminalSize`.
+* On Unix-like operating systems, fix a bug where `getReportedCursorPosition`
+  could block indefinitely if no information was forthcoming on the console
+  input stream.
+* Improvements to Haddock documentation.
+
+Version 0.10
+------------
+
+* Add support for setting the default color with new `SetDefaultColor`
+  constructor of the `SGR` type.
+* `getTerminalSize` now flushes the `stdout` channel, to ensure the cursor
+  position is unaffected.
+
+Version 0.9.1
+-------------
+
+* Flag modules with GHC's 'Safe Haskell' language extensions (from GHC 7.2.1).
+* Improvements and corrections to Haddock documentation.
+
 Version 0.9
 -----------
 
 * Add support for 256-color palettes with new `SetPaletteColor` constructor of
-  `SGR` type, and `xterm6LevelRGB`, `xterm24LevelGray` and `xtermSystem`.
+  the `SGR` type, and `xterm6LevelRGB`, `xterm24LevelGray` and `xtermSystem`.
 * Remove deprecated `getCursorPosition`. (Use `getCursorPosition0` instead.)
 * Add `hSupportsANSIColor`.
 * Add `getTerminalSize`.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansi-terminal-0.9/ansi-terminal.cabal 
new/ansi-terminal-0.10.2/ansi-terminal.cabal
--- old/ansi-terminal-0.9/ansi-terminal.cabal   2019-01-26 20:49:22.000000000 
+0100
+++ new/ansi-terminal-0.10.2/ansi-terminal.cabal        2019-11-20 
23:52:51.000000000 +0100
@@ -1,5 +1,5 @@
 Name:                ansi-terminal
-Version:             0.9
+Version:             0.10.2
 Cabal-Version:       >= 1.8
 Category:            User Interfaces
 Synopsis:            Simple ANSI terminal support, with Windows compatibility
@@ -16,6 +16,7 @@
 Extra-Source-Files:     src/includes/Common-Include.hs
                         src/includes/Common-Include-Emulator.hs
                         src/includes/Common-Include-Enabled.hs
+                        src/includes/Common-Safe-Haskell.hs
                         src/includes/Exports-Include.hs
                         CHANGELOG.md
                         README.md
@@ -37,7 +38,7 @@
         Include-Dirs:           src/includes
 
         Build-Depends:          base >= 4.3.0.0 && < 5
-                              , colour
+                              , colour >=2.1.0
         if os(windows)
                 Build-Depends:          containers >= 0.5.0.0
                                       , mintty
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansi-terminal-0.9/src/System/Console/ANSI/Codes.hs 
new/ansi-terminal-0.10.2/src/System/Console/ANSI/Codes.hs
--- old/ansi-terminal-0.9/src/System/Console/ANSI/Codes.hs      2019-01-26 
19:23:26.000000000 +0100
+++ new/ansi-terminal-0.10.2/src/System/Console/ANSI/Codes.hs   2019-09-05 
22:30:23.000000000 +0200
@@ -1,19 +1,21 @@
--- | This module exports functions that return 'String' values containing codes
--- in accordance with the \'ANSI\' standards for control character sequences
--- described in the documentation of module "System.Console.ANSI".
---
--- The module "System.Console.ANSI" exports functions with the same names as
--- those in this module. On some versions of Windows, the terminal in use may
--- not be ANSI-capable. When that is the case, the same-named functions 
exported
--- by module "System.Console.ANSI" return \"\", for the reasons set out in the
--- documentation of that module.
---
--- Consequently, if module "System.Console.ANSI" is also imported, this module
--- is intended to be imported qualified, to avoid name clashes with those
--- functions. For example:
---
--- > import qualified System.Console.ANSI.Codes as ANSI
---
+#include "Common-Safe-Haskell.hs"
+
+{-| This module exports functions that return 'String' values containing codes
+in accordance with the \'ANSI\' standards for control character sequences
+described in the documentation of module "System.Console.ANSI".
+
+The module "System.Console.ANSI" exports functions with the same names as those
+in this module. On some versions of Windows, the terminal in use may not be
+ANSI-capable. When that is the case, the same-named functions exported by 
module
+"System.Console.ANSI" return \"\", for the reasons set out in the documentation
+of that module.
+
+Consequently, if module "System.Console.ANSI" is also imported, this module is
+intended to be imported qualified, to avoid name clashes with those functions.
+For example:
+
+> import qualified System.Console.ANSI.Codes as ANSI
+-}
 module System.Console.ANSI.Codes
   (
     -- * Basic data types
@@ -119,6 +121,8 @@
   SetPaletteColor Background index -> [48, 5, fromIntegral index]
   SetRGBColor Foreground color -> [38, 2] ++ toRGB color
   SetRGBColor Background color -> [48, 2] ++ toRGB color
+  SetDefaultColor Foreground -> [39]
+  SetDefaultColor Background -> [49]
  where
   toRGB color = let RGB r g b = toSRGB24 color
                 in  map fromIntegral [r, g, b]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansi-terminal-0.9/src/System/Console/ANSI/Types.hs 
new/ansi-terminal-0.10.2/src/System/Console/ANSI/Types.hs
--- old/ansi-terminal-0.9/src/System/Console/ANSI/Types.hs      2019-01-26 
19:23:26.000000000 +0100
+++ new/ansi-terminal-0.10.2/src/System/Console/ANSI/Types.hs   2019-09-05 
23:11:06.000000000 +0200
@@ -1,13 +1,15 @@
--- | The \'ANSI\' standards refer to the visual style of displaying characters
--- as their \'graphic rendition\'. The style includes the color of a character
--- or its background, the intensity (bold, normal or faint) of a character, or
--- whether the character is italic or underlined (single or double), blinking
--- (slowly or rapidly) or visible or not. The \'ANSI\' codes to establish the
--- graphic rendition for subsequent text are referred to as SELECT GRAPHIC
--- RENDITION (SGR).
---
--- This module exports types and functions used to represent SGR aspects. See
--- also 'System.Console.ANSI.setSGR' and related functions.
+#include "Common-Safe-Haskell.hs"
+
+{-| The \'ANSI\' standards refer to the visual style of displaying characters 
as
+their \'graphic rendition\'. The style includes the color of a character or its
+background, the intensity (bold, normal or faint) of a character, or whether 
the
+character is italic or underlined (single or double), blinking (slowly or
+rapidly) or visible or not. The \'ANSI\' codes to establish the graphic
+rendition for subsequent text are referred to as SELECT GRAPHIC RENDITION 
(SGR).
+
+This module exports types and functions used to represent SGR aspects. See also
+'System.Console.ANSI.setSGR' and related functions.
+-}
 module System.Console.ANSI.Types
   (
   -- * Types used to represent SGR aspects
@@ -130,6 +132,10 @@
   --
   -- @since 0.9
   | SetPaletteColor !ConsoleLayer !Word8
+  -- | Set a color to the default (implementation-defined)
+  --
+  -- @since 0.10
+  | SetDefaultColor !ConsoleLayer
   deriving (Eq, Show, Read)
 
 -- | Given xterm's standard protocol for a 256-color palette, returns the index
@@ -137,7 +143,7 @@
 -- colors. Throws an error if any of the red, green or blue channels is outside
 -- the range 0 to 5. An example of use is:
 --
--- >>> setSGR [ SetRGBColor $ xterm6LevelRGB 5 2 0 ] -- Dark Orange
+-- >>> setSGR [ SetPaletteColor $ xterm6LevelRGB 5 2 0 ] -- Dark Orange
 --
 -- @since 0.9
 xterm6LevelRGB :: Int -> Int -> Int -> Word8
@@ -155,7 +161,7 @@
 -- gray (0) to near white (23) (black and white are themselves excluded). 
Throws
 -- an error if the gray is outside of the range 0 to 23. An example of use is:
 --
--- >>> setSGR [ SetRGBColor $ xterm24LevelGray 12 ] -- Gray50
+-- >>> setSGR [ SetPaletteColor $ xterm24LevelGray 12 ] -- Gray50
 --
 -- @since 0.9
 xterm24LevelGray :: Int -> Word8
@@ -171,7 +177,7 @@
 -- standard, or \'system\', colors (eight colors in two intensities). An 
example
 -- of use is:
 --
--- >>> setSGR [ SetRGBColor $ xtermSystem Vivid Green ]
+-- >>> setSGR [ SetPaletteColor $ xtermSystem Vivid Green ]
 --
 -- @since 0.9
 xtermSystem :: ColorIntensity -> Color -> Word8
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansi-terminal-0.9/src/System/Console/ANSI/Unix.hs 
new/ansi-terminal-0.10.2/src/System/Console/ANSI/Unix.hs
--- old/ansi-terminal-0.9/src/System/Console/ANSI/Unix.hs       2019-01-26 
19:39:24.000000000 +0100
+++ new/ansi-terminal-0.10.2/src/System/Console/ANSI/Unix.hs    2019-11-18 
21:30:00.000000000 +0100
@@ -1,3 +1,4 @@
+#include "Common-Safe-Haskell.hs"
 {-# OPTIONS_HADDOCK hide #-}
 
 module System.Console.ANSI.Unix
@@ -8,10 +9,11 @@
 #include "Exports-Include.hs"
   ) where
 
+import Data.Maybe (fromMaybe)
 import Control.Exception.Base (bracket)
-import System.IO (BufferMode (..), Handle, hFlush, hGetBuffering, hGetEcho,
-  hIsTerminalDevice, hIsWritable, hPutStr, hSetBuffering, hSetEcho, stdin,
-  stdout)
+import System.IO (BufferMode (..), Handle, hGetBuffering, hGetEcho,
+  hIsTerminalDevice, hIsWritable, hPutStr, hSetBuffering, hSetEcho, stdin)
+import System.Timeout (timeout)
 import Text.ParserCombinators.ReadP (readP_to_S)
 
 import System.Console.ANSI.Codes
@@ -81,7 +83,10 @@
 -- (See Common-Include.hs for Haddock documentation)
 getReportedCursorPosition = bracket (hGetEcho stdin) (hSetEcho stdin) $ \_ -> 
do
   hSetEcho stdin False   -- Turn echo off
-  get
+  -- If, unexpectedly, no data is available on the console input stream then
+  -- the timeout will prevent the getChar blocking. For consistency with the
+  -- Windows equivalent, returns "" if the expected information is unavailable.
+  fromMaybe "" <$> timeout 500000 get -- 500 milliseconds
  where
   get = do
     c <- getChar
@@ -98,9 +103,9 @@
                       -- in order to avoid O(n^2) complexity.
       else return $ reverse (c:s) -- Reverse the order of the built list.
 
--- getCursorPosition0 :: IO (Maybe (Int, Int))
+-- hGetCursorPosition :: Handle -> IO (Maybe (Int, Int))
 -- (See Common-Include.hs for Haddock documentation)
-getCursorPosition0 = fmap to0base <$> getCursorPosition
+hGetCursorPosition h = fmap to0base <$> getCursorPosition
  where
   to0base (row, col) = (row - 1, col - 1)
   getCursorPosition = do
@@ -109,9 +114,9 @@
                                       -- buffer will be discarded, so this 
needs
                                       -- to be done before the cursor positon 
is
                                       -- emitted)
-      reportCursorPosition
-      hFlush stdout -- ensure the report cursor position code is sent to the
-                    -- operating system
+      hReportCursorPosition h
+      hFlush h -- ensure the report cursor position code is sent to the
+               -- operating system
       getReportedCursorPosition
     case readP_to_S cursorPosition input of
       [] -> return Nothing
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ansi-terminal-0.9/src/System/Console/ANSI/Windows/Detect.hs 
new/ansi-terminal-0.10.2/src/System/Console/ANSI/Windows/Detect.hs
--- old/ansi-terminal-0.9/src/System/Console/ANSI/Windows/Detect.hs     
2018-09-08 18:58:56.000000000 +0200
+++ new/ansi-terminal-0.10.2/src/System/Console/ANSI/Windows/Detect.hs  
2019-09-05 22:30:23.000000000 +0200
@@ -1,3 +1,4 @@
+{-# LANGUAGE Trustworthy #-}
 {-# OPTIONS_HADDOCK hide #-}
 
 module System.Console.ANSI.Windows.Detect
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ansi-terminal-0.9/src/System/Console/ANSI/Windows/Emulator/Codes.hs 
new/ansi-terminal-0.10.2/src/System/Console/ANSI/Windows/Emulator/Codes.hs
--- old/ansi-terminal-0.9/src/System/Console/ANSI/Windows/Emulator/Codes.hs     
2018-03-03 13:19:27.000000000 +0100
+++ new/ansi-terminal-0.10.2/src/System/Console/ANSI/Windows/Emulator/Codes.hs  
2019-09-05 22:30:23.000000000 +0200
@@ -1,3 +1,4 @@
+#include "Common-Safe-Haskell.hs"
 {-# OPTIONS_HADDOCK hide #-}
 
 module System.Console.ANSI.Windows.Emulator.Codes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ansi-terminal-0.9/src/System/Console/ANSI/Windows/Emulator.hs 
new/ansi-terminal-0.10.2/src/System/Console/ANSI/Windows/Emulator.hs
--- old/ansi-terminal-0.9/src/System/Console/ANSI/Windows/Emulator.hs   
2019-01-26 19:39:24.000000000 +0100
+++ new/ansi-terminal-0.10.2/src/System/Console/ANSI/Windows/Emulator.hs        
2019-11-19 23:32:07.000000000 +0100
@@ -1,3 +1,4 @@
+{-# LANGUAGE Trustworthy #-}
 {-# OPTIONS_HADDOCK hide #-}
 
 module System.Console.ANSI.Windows.Emulator
@@ -13,7 +14,7 @@
 import Data.List (foldl', minimumBy)
 import Data.Maybe (mapMaybe)
 import qualified Data.Map.Strict as Map (Map, empty, insert, lookup)
-import System.IO (Handle, hFlush, hIsTerminalDevice, stdin, stdout)
+import System.IO (Handle, hIsTerminalDevice, stdin)
 import System.IO.Unsafe (unsafePerformIO)
 import Text.ParserCombinators.ReadP (readP_to_S)
 
@@ -76,9 +77,15 @@
 adjustCursorPosition handle change_x change_y = do
   screen_buffer_info <- getConsoleScreenBufferInfo handle
   let window = csbi_window screen_buffer_info
+      l = rect_left window
+      t = rect_top window
+      r = rect_right window
+      b = rect_bottom window
       (COORD x y) = csbi_cursor_position screen_buffer_info
-      cursor_pos'= COORD (change_x (rect_left window) x)
-                         (change_y (rect_top window) y)
+      clamp mn mx = max mn . min mx
+      x' = clamp l r (change_x l x)
+      y' = clamp t b (change_y t y)
+      cursor_pos' = COORD x' y'
   setConsoleCursorPosition handle cursor_pos'
 
 hCursorUp h n
@@ -262,6 +269,12 @@
 applyANSISGRToAttribute :: WORD -> SGR -> WORD -> WORD
 applyANSISGRToAttribute def sgr attribute = case sgr of
   Reset -> def
+  SetDefaultColor Foreground ->
+    (attribute .&. complement fOREGROUND_INTENSE_WHITE) .|.
+    (def .&. fOREGROUND_INTENSE_WHITE)
+  SetDefaultColor Background ->
+    (attribute .&. complement bACKGROUND_INTENSE_WHITE) .|.
+    (def .&. bACKGROUND_INTENSE_WHITE)
   SetConsoleIntensity intensity -> case intensity of
     BoldIntensity   -> attribute .|. iNTENSITY
     FaintIntensity  -> attribute .&. (complement iNTENSITY) -- Not supported
@@ -470,18 +483,18 @@
       isKeyDown = keyEventKeyDown keyEventRecord
       isKeyDownEvent = eventType == 1 && isKeyDown
 
--- getCursorPosition0 :: IO (Maybe (Int, Int))
+-- hGetCursorPosition :: Handle -> IO (Maybe (Int, Int))
 -- (See Common-Include.hs for Haddock documentation)
-getCursorPosition0 = fmap to0base <$> getCursorPosition
+hGetCursorPosition h = fmap to0base <$> getCursorPosition
  where
   to0base (row, col) = (row - 1, col - 1)
   getCursorPosition = CE.catch getCursorPosition' getCPExceptionHandler
    where
     getCursorPosition' = do
       withHandleToHANDLE stdin flush -- Flush the console input buffer
-      reportCursorPosition
-      hFlush stdout -- ensure the report cursor position code is sent to the
-                    -- operating system
+      hReportCursorPosition h
+      hFlush h -- ensure the report cursor position code is sent to the
+               -- operating system
       input <- getReportedCursorPosition
       case readP_to_S cursorPosition input of
         [] -> return Nothing
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ansi-terminal-0.9/src/System/Console/ANSI/Windows/Foreign.hs 
new/ansi-terminal-0.10.2/src/System/Console/ANSI/Windows/Foreign.hs
--- old/ansi-terminal-0.9/src/System/Console/ANSI/Windows/Foreign.hs    
2018-03-03 13:19:27.000000000 +0100
+++ new/ansi-terminal-0.10.2/src/System/Console/ANSI/Windows/Foreign.hs 
2019-09-05 22:30:23.000000000 +0200
@@ -1,9 +1,11 @@
-{-# OPTIONS_HADDOCK hide #-}
-{-# LANGUAGE RankNTypes #-}
+#include "Common-Safe-Haskell.hs"
+{-# OPTIONS_HADDOCK hide        #-}
+{-# LANGUAGE RankNTypes         #-}
 {-# LANGUAGE DeriveDataTypeable #-}
 
--- | "System.Win32.Console" is really very impoverished, so I have had to do 
all
--- the FFI myself.
+{-| "System.Win32.Console" is really very impoverished, so I have had to do all
+the FFI myself.
+-}
 module System.Console.ANSI.Windows.Foreign
   (
     -- Re-exports from Win32.Types
@@ -58,8 +60,9 @@
 import Data.Char (chr, ord)
 import Data.Typeable (Typeable)
 import Foreign.C.Types (CInt (..), CWchar (..))
-import Foreign.Marshal (alloca, allocaArray, maybeWith, peekArray, with,
-  withArrayLen)
+import Foreign.Marshal.Alloc (alloca)
+import Foreign.Marshal.Array (allocaArray, peekArray, withArrayLen)
+import Foreign.Marshal.Utils (maybeWith, with)
 import Foreign.Ptr (Ptr, castPtr, plusPtr)
 import Foreign.Storable (Storable (..))
 -- `SHORT` and `withHandleToHANDLE` are not both available before Win32-2.5.1.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansi-terminal-0.9/src/System/Console/ANSI/Windows.hs 
new/ansi-terminal-0.10.2/src/System/Console/ANSI/Windows.hs
--- old/ansi-terminal-0.9/src/System/Console/ANSI/Windows.hs    2019-01-26 
19:39:24.000000000 +0100
+++ new/ansi-terminal-0.10.2/src/System/Console/ANSI/Windows.hs 2019-11-18 
21:30:00.000000000 +0100
@@ -1,3 +1,4 @@
+#include "Common-Safe-Haskell.hs"
 {-# OPTIONS_HADDOCK hide #-}
 
 module System.Console.ANSI.Windows
@@ -8,7 +9,7 @@
 #include "Exports-Include.hs"
   ) where
 
-import System.IO (Handle, stdout)
+import System.IO (Handle)
 
 import System.Console.ANSI.Types
 import qualified System.Console.ANSI.Unix as U
@@ -190,6 +191,6 @@
 -- (See Common-Include.hs for Haddock documentation)
 getReportedCursorPosition = E.getReportedCursorPosition
 
--- getCursorPosition0 :: IO (Maybe (Int, Int))
+-- hGetCursorPosition :: Handle -> IO (Maybe (Int, Int))
 -- (See Common-Include.hs for Haddock documentation)
-getCursorPosition0 = E.getCursorPosition0
+hGetCursorPosition = E.hGetCursorPosition
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansi-terminal-0.9/src/System/Console/ANSI.hs 
new/ansi-terminal-0.10.2/src/System/Console/ANSI.hs
--- old/ansi-terminal-0.9/src/System/Console/ANSI.hs    2019-01-26 
19:23:26.000000000 +0100
+++ new/ansi-terminal-0.10.2/src/System/Console/ANSI.hs 2019-11-18 
21:30:00.000000000 +0100
@@ -1,102 +1,126 @@
--- | Through this module, this library provides platform-independent support
--- for control character sequences following the \'ANSI\' standards (see 
further
--- below) for terminal software that supports those sequences, running on a
--- Unix-like operating system or Windows.
---
--- The sequences of control characters (also referred to as \'escape\' 
sequences
--- or codes) provide a rich range of functionality for terminal control, which
--- includes:
---
---  * Colored text output, with control over both foreground and background
---    colors
---
---  * Clearing parts of a line or the screen
---
---  * Hiding or showing the cursor
---
---  * Moving the cursor around
---
---  * Reporting the position of the cursor
---
---  * Scrolling the screen up or down
---
---  * Changing the title of the terminal
---
--- The functions moving the cursor to an absolute position are 0-based (the
--- top-left corner is considered to be at row 0 column 0) (see
--- 'setCursorPosition') and so is 'getCursorPosition0'. The \'ANSI\' standards
--- themselves are 1-based (that is, the top-left corner is considered to be at
--- row 1 column 1) and some functions reporting the position of the cursor are
--- too (see 'reportCursorPosition').
---
--- The native terminal software on Windows is \'Command Prompt\' or
--- \`PowerShell\`. Before Windows 10 version 1511 (known as the \'November
--- [2015] Update\' or \'Threshold 2\') that software did not support such
--- control sequences. For that software, this library also provides support for
--- such sequences by using emulation.
---
--- Terminal software other than the native software exists for Windows. One
--- example is the \'mintty\' terminal emulator for \'Cygwin\', \'MSYS\' or
--- \'MSYS2\', and dervied projects, and for \'WSL\' (Windows Subsystem for
--- Linux).
---
--- The \'ANSI\' standards refer to (1) standard ECMA-48 \`Control Functions for
--- Coded Character Sets\' (5th edition, 1991); (2) extensions in ITU-T
--- Recommendation (previously CCITT Recommendation) T.416 (03/93) \'Information
--- Technology – Open Document Architecture (ODA) and Interchange Format:
--- Character Content Architectures\` (also published as ISO/IEC International
--- Standard 8613-6); and (3) further extensions used by \'XTerm\', a terminal
--- emulator for the X Window System. The escape codes are described in a
--- Wikipedia article at <http://en.wikipedia.org/wiki/ANSI_escape_code> and
--- those codes supported on current versions of Windows at
--- 
<https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences>.
---
--- The whole of the \'ANSI\' standards are not supported by this library but
--- most (if not all) of the parts that are popular and well-supported by
--- terminal software are supported. Every function exported by this module 
comes
--- in three variants, namely:
---
---  * A variant that has an @IO ()@ type and doesn't take a @Handle@ (for
---    example, @clearScreen :: IO ()@). This variant just outputs the \`ANSI\`
---    command directly to the standard output channel ('stdout') and any
---    terminal corresponding to it. Commands issued like this should work as 
you
---    expect on both Unix-like operating systems and Windows.
---
---  * An \'@h@...\' variant that has an @IO ()@ type but takes a @Handle@ (for
---    example, @hClearScreen :: Handle -> IO ()@). This variant outputs the
---    \`ANSI\` command to the supplied handle and any terminal corresponding to
---    it. Commands issued like this should also work as you expect on both
---    Unix-like operating systems and Windows.
---
---  * A \'...@Code@\' variant that has a @String@ type (for example,
---    @clearScreenCode :: String@). This variant outputs the sequence of 
control
---    characters as a 'String', which can be added to any other bit of text
---    before being output. The use of these codes is generally discouraged
---    because they will not work on legacy versions of Windows where the
---    terminal in use is not ANSI-enabled (see further above). On Windows, 
where
---    emulation has been necessary, these variants will always output the empty
---    string. That is done so that it is possible to use them portably; for
---    example, coloring console output on the understanding that you will see
---    colors only if you are running on a Unix-like operating system or a
---    version of Windows where emulation has not been necessary. If the control
---    characters are always required, see module "System.Console.ANSI.Codes".
---
--- Example:
---
--- > module Main where
--- >
--- > import System.Console.ANSI
--- >
--- > -- Set colors and write some text in those colors.
--- > main = do
--- >   setSGR [SetColor Foreground Vivid Red]
--- >   setSGR [SetColor Background Vivid Blue]
--- >   putStrLn "Red-On-Blue"
--- >   setSGR [Reset]  -- Reset to default colour scheme
--- >   putStrLn "Default colors."
---
--- For many more examples, see the project's extensive
--- <https://github.com/feuerbach/ansi-terminal/blob/master/app/Example.hs 
Example.hs> file.
+#include "Common-Safe-Haskell.hs"
+
+{-| Through this module, this library provides platform-independent support for
+control character sequences following the \'ANSI\' standards (see further 
below)
+for terminal software that supports those sequences, running on a Unix-like
+operating system or Windows.
+
+The sequences of control characters (also referred to as \'escape\' sequences 
or
+codes) provide a rich range of functionality for terminal control, which
+includes:
+
+ * Colored text output, with control over both foreground and background colors
+
+ * Clearing parts of a line or the screen
+
+ * Hiding or showing the cursor
+
+ * Moving the cursor around
+
+ * Reporting the position of the cursor
+
+ * Scrolling the screen up or down
+
+ * Changing the title of the terminal
+
+A terminal that supports control character sequences acts on them when they
+are flushed from the output buffer (with a newline character @\"\\n\"@ or, for
+the standard output channel, @hFlush stdout@).
+
+The functions moving the cursor to an absolute position are 0-based (the
+top-left corner is considered to be at row 0 column 0) (see 
'setCursorPosition')
+and so is 'getCursorPosition0'. The \'ANSI\' standards themselves are 1-based
+(that is, the top-left corner is considered to be at row 1 column 1) and some
+functions reporting the position of the cursor are too (see
+'reportCursorPosition').
+
+The native terminal software on Windows is \'Command Prompt\' or 
\`PowerShell\`.
+Before Windows 10 version 1511 (known as the \'November [2015] Update\' or
+\'Threshold 2\') that software did not support such control sequences. For that
+software, this library also provides support for such sequences by using
+emulation.
+
+Terminal software other than the native software exists for Windows. One 
example
+is the \'mintty\' terminal emulator for \'Cygwin\', \'MSYS\' or \'MSYS2\', and
+dervied projects, and for \'WSL\' (Windows Subsystem for Linux).
+
+The \'ANSI\' standards refer to (1) standard ECMA-48 \`Control Functions for
+Coded Character Sets\' (5th edition, 1991); (2) extensions in ITU-T
+Recommendation (previously CCITT Recommendation) T.416 (03/93) \'Information
+Technology – Open Document Architecture (ODA) and Interchange Format: Character
+Content Architectures\` (also published as ISO/IEC International Standard
+8613-6); and (3) further extensions used by \'XTerm\', a terminal emulator for
+the X Window System. The escape codes are described in a Wikipedia article at
+<http://en.wikipedia.org/wiki/ANSI_escape_code> and those codes supported on
+current versions of Windows at
+<https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences>.
+
+The whole of the \'ANSI\' standards are not supported by this library but most
+(if not all) of the parts that are popular and well-supported by terminal
+software are supported. Every function exported by this module comes in three
+variants, namely:
+
+ * A variant that has an @IO ()@ type and doesn't take a @Handle@ (for example,
+   @clearScreen :: IO ()@). This variant just outputs the \`ANSI\` command
+   directly to the standard output channel ('stdout') and any terminal
+   corresponding to it. Commands issued like this should work as you expect on
+   both Unix-like operating systems and Windows.
+
+ * An \'@h@...\' variant that has an @IO ()@ type but takes a @Handle@ (for
+   example, @hClearScreen :: Handle -> IO ()@). This variant outputs the
+   \`ANSI\` command to the supplied handle and any terminal corresponding to 
it.
+   Commands issued like this should also work as you expect on both Unix-like
+   operating systems and Windows.
+
+ * A \'...@Code@\' variant that has a @String@ type (for example,
+   @clearScreenCode :: String@). This variant outputs the sequence of control
+   characters as a 'String', which can be added to any other bit of text before
+   being output. The use of these codes is generally discouraged because they
+   will not work on legacy versions of Windows where the terminal in use is not
+   ANSI-enabled (see further above). On Windows, where emulation has been
+   necessary, these variants will always output the empty string. That is done
+   so that it is possible to use them portably; for example, coloring console
+   output on the understanding that you will see colors only if you are running
+   on a Unix-like operating system or a version of Windows where emulation has
+   not been necessary. If the control characters are always required, see 
module
+   "System.Console.ANSI.Codes".
+
+Example:
+
+> module Main where
+>
+> import System.Console.ANSI
+>
+> -- Set colors and write some text in those colors.
+> main :: IO ()
+> main = do
+>   setSGR [SetColor Foreground Vivid Red]
+>   setSGR [SetColor Background Vivid Blue]
+>   putStrLn "Red-On-Blue"
+>   setSGR [Reset]  -- Reset to default colour scheme
+>   putStrLn "Default colors."
+
+Another example:
+
+> module Main where
+>
+> import System.IO (hFlush, stdout)
+> import System.Console.ANSI
+>
+> main :: IO ()
+> main = do
+>   setSGR [SetColor Foreground Dull Blue]
+>   putStr "Enter your name: "
+>   setSGR [SetColor Foreground Dull Yellow]
+>   hFlush stdout  -- flush the output buffer before getLine
+>   name <- getLine
+>   setSGR [SetColor Foreground Dull Blue]
+>   putStrLn $ "Hello, " ++ name ++ "!"
+>   setSGR [Reset]  -- reset to default colour scheme
+
+For many more examples, see the project's extensive
+<https://github.com/feuerbach/ansi-terminal/blob/master/app/Example.hs 
Example.hs> file.
+-}
 #if defined(WINDOWS)
 module System.Console.ANSI
   (
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansi-terminal-0.9/src/System/Win32/Compat.hs 
new/ansi-terminal-0.10.2/src/System/Win32/Compat.hs
--- old/ansi-terminal-0.9/src/System/Win32/Compat.hs    2018-03-03 
13:19:27.000000000 +0100
+++ new/ansi-terminal-0.10.2/src/System/Win32/Compat.hs 2019-09-05 
22:30:23.000000000 +0200
@@ -1,8 +1,9 @@
+#include "Common-Safe-Haskell.hs"
 {-# OPTIONS_HADDOCK hide #-}
 
 {-| The Win32 library ships with GHC. Win32-2.1 first shipped with GHC 6.6
-(released October 2006). Win32-2.5.4.1 first shipped with GHC 8.2.1
-(released July 2017), replacing Win32-2.3.1.1.
+(released October 2006). Win32-2.5.4.1 first shipped with GHC 8.2.1 (released
+July 2017), replacing Win32-2.3.1.1.
 
 The ansi-terminal library makes use of functionality in Win32-2.1 and other
 functionality first added to Win32-2.5.0.0 or Win32-2.5.1.0 (from ansi-terminal
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansi-terminal-0.9/src/includes/Common-Include.hs 
new/ansi-terminal-0.10.2/src/includes/Common-Include.hs
--- old/ansi-terminal-0.9/src/includes/Common-Include.hs        2019-01-26 
19:40:00.000000000 +0100
+++ new/ansi-terminal-0.10.2/src/includes/Common-Include.hs     2019-11-19 
23:36:37.000000000 +0100
@@ -5,13 +5,14 @@
 -- documentation.
 
 #if !MIN_VERSION_base(4,8,0)
-import Control.Applicative
+import Control.Applicative ((<*>))
+import Data.Functor ((<$>))
 #endif
 
 import Control.Monad (void)
 import Data.Char (isDigit)
-import Data.Functor ((<$>))
 import System.Environment (getEnvironment)
+import System.IO (hFlush, stdout)
 import Text.ParserCombinators.ReadP (char, many1, ReadP, satisfy)
 
 hCursorUp, hCursorDown, hCursorForward, hCursorBackward
@@ -137,6 +138,8 @@
 -- | Some terminals (e.g. Emacs) are not fully ANSI compliant but can support
 -- ANSI colors. This can be used in such cases, if colors are all that is
 -- needed.
+--
+-- @since 0.9
 hSupportsANSIColor :: Handle -> IO Bool
 hSupportsANSIColor h = (||) <$> hSupportsANSI h <*> isEmacsTerm
   where
@@ -224,10 +227,12 @@
 -- 'reportCursorPosition', 'getReportedCursorPosition' and 'cursorPosition'. 
Any
 -- position @(row, column)@ is translated to be 0-based (that is, the top-left
 -- corner is at @(0, 0)@), consistent with `setCursorColumn` and
--- `setCursorPosition`. (Note that the information emitted by
--- 'reportCursorPosition' is 1-based.) Returns 'Nothing' if any data emitted by
--- 'reportCursorPosition', obtained by 'getReportedCursorPosition', cannot be
--- parsed by 'cursorPosition'.
+-- `setCursorPosition`. (Note that the information emitted into the console
+-- input stream by 'reportCursorPosition' is 1-based.) Returns 'Nothing' if any
+-- data emitted by 'reportCursorPosition', obtained by
+-- 'getReportedCursorPosition', cannot be parsed by 'cursorPosition'. Uses
+-- 'stdout'. If 'stdout' will be redirected, see 'hGetCursorPosition' for a 
more
+-- general function.
 --
 -- On Windows operating systems, the function is not supported on consoles, 
such
 -- as mintty, that are not based on the Win32 console of the Windows API.
@@ -235,10 +240,30 @@
 --
 -- @since 0.8.2
 getCursorPosition0 :: IO (Maybe (Int, Int))
+getCursorPosition0 = hGetCursorPosition stdout
+
+-- | Attempts to get the reported cursor position, combining the functions
+-- 'hReportCursorPosition' (with the specified handle),
+-- 'getReportedCursorPosition' and 'cursorPosition'. Any position
+-- @(row, column)@ is translated to be 0-based (that is, the top-left corner is
+-- at @(0, 0)@), consistent with 'hSetCursorColumn' and 'hSetCursorPosition'.
+-- (Note that the information emitted into the console input stream by
+-- 'hReportCursorPosition' is 1-based.) Returns 'Nothing' if any data emitted 
by
+-- 'hReportCursorPosition', obtained by 'getReportedCursorPosition', cannot be
+-- parsed by 'cursorPosition'.
+--
+-- On Windows operating systems, the function is not supported on consoles, 
such
+-- as mintty, that are not based on the Win32 console of the Windows API.
+-- (Command Prompt and PowerShell are based on the Win32 console.)
+--
+-- @since 0.10.1
+hGetCursorPosition :: Handle -> IO (Maybe (Int, Int))
 
 -- | Attempts to get the current terminal size (height in rows, width in
--- columns), by using `getCursorPosition0` after attempting to set the cursor
--- position beyond the bottom right corner of the terminal.
+-- columns), by using 'getCursorPosition0' to query the console input stream
+-- after attempting to set the cursor position beyond the bottom right corner 
of
+-- the terminal. Uses 'stdout'. If 'stdout' will be redirected, see
+-- 'hGetTerminalSize' for a more general function.
 --
 -- On Windows operating systems, the function is not supported on consoles, 
such
 -- as mintty, that are not based on the Win32 console of the Windows API.
@@ -246,10 +271,26 @@
 --
 -- @since 0.9
 getTerminalSize :: IO (Maybe (Int, Int))
-getTerminalSize = do
-  saveCursor
-  setCursorPosition 999 999  -- Attempt to set the cursor position beyond the
-                             -- bottom right corner of the terminal.
-  mPos <- getCursorPosition0
-  restoreCursor
+getTerminalSize = hGetTerminalSize stdout
+
+-- | Attempts to get the current terminal size (height in rows, width in
+-- columns), by writing control character sequences to the specified handle
+-- (which will typically be 'stdout' or 'stderr') and using 
'hGetCursorPosition'
+-- to query the console input stream after attempting to set the cursor 
position
+-- beyond the bottom right corner of the terminal.
+--
+-- On Windows operating systems, the function is not supported on consoles, 
such
+-- as mintty, that are not based on the Win32 console of the Windows API.
+-- (Command Prompt and PowerShell are based on the Win32 console.)
+--
+-- @since 0.10.1
+hGetTerminalSize :: Handle -> IO (Maybe (Int, Int))
+hGetTerminalSize h = do
+  hSaveCursor h
+  hSetCursorPosition h 9999 9999  -- Attempt to set the cursor position beyond
+                                  -- the bottom right corner of the terminal.
+  mPos <- hGetCursorPosition h
+  hRestoreCursor h
+  hFlush h -- ensure the restore cursor position code is sent to the
+           -- operating system
   return $ fmap (\(r, c) -> (r + 1, c + 1)) mPos
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ansi-terminal-0.9/src/includes/Common-Safe-Haskell.hs 
new/ansi-terminal-0.10.2/src/includes/Common-Safe-Haskell.hs
--- old/ansi-terminal-0.9/src/includes/Common-Safe-Haskell.hs   1970-01-01 
01:00:00.000000000 +0100
+++ new/ansi-terminal-0.10.2/src/includes/Common-Safe-Haskell.hs        
2019-09-05 22:30:23.000000000 +0200
@@ -0,0 +1,5 @@
+#if __GLASGOW_HASKELL__ >= 704
+{-# LANGUAGE Safe #-}
+#elif __GLASGOW_HASKELL__ >= 702
+{-# LANGUAGE Trustworthy #-}
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansi-terminal-0.9/src/includes/Exports-Include.hs 
new/ansi-terminal-0.10.2/src/includes/Exports-Include.hs
--- old/ansi-terminal-0.9/src/includes/Exports-Include.hs       2019-01-26 
19:25:41.000000000 +0100
+++ new/ansi-terminal-0.10.2/src/includes/Exports-Include.hs    2019-11-18 
21:30:00.000000000 +0100
@@ -112,8 +112,10 @@
 
     -- * Getting the cursor position
   , getCursorPosition0
+  , hGetCursorPosition
   , getReportedCursorPosition
   , cursorPosition
 
     -- * Getting the terminal size
   , getTerminalSize
+  , hGetTerminalSize


Reply via email to