Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package ghc-ansi-terminal for 
openSUSE:Factory checked in at 2024-12-20 23:10:04
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-ansi-terminal (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-ansi-terminal.new.1881 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-ansi-terminal"

Fri Dec 20 23:10:04 2024 rev:26 rq:1231415 version:1.1.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-ansi-terminal/ghc-ansi-terminal.changes      
2024-01-21 23:10:11.721527688 +0100
+++ 
/work/SRC/openSUSE:Factory/.ghc-ansi-terminal.new.1881/ghc-ansi-terminal.changes
    2024-12-20 23:10:13.731505680 +0100
@@ -1,0 +2,9 @@
+Thu Nov 14 21:54:01 UTC 2024 - Peter Simons <[email protected]>
+
+- Update ansi-terminal to version 1.1.2.
+  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-1.1.2/src/CHANGELOG.md
+
+-------------------------------------------------------------------

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

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

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

Other differences:
------------------
++++++ ghc-ansi-terminal.spec ++++++
--- /var/tmp/diff_new_pack.vvhqtr/_old  2024-12-20 23:10:14.155523143 +0100
+++ /var/tmp/diff_new_pack.vvhqtr/_new  2024-12-20 23:10:14.155523143 +0100
@@ -19,7 +19,7 @@
 %global pkg_name ansi-terminal
 %global pkgver %{pkg_name}-%{version}
 Name:           ghc-%{pkg_name}
-Version:        1.0.2
+Version:        1.1.2
 Release:        0
 Summary:        Simple ANSI terminal support
 License:        BSD-3-Clause

++++++ ansi-terminal-1.0.2.tar.gz -> ansi-terminal-1.1.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansi-terminal-1.0.2/CHANGELOG.md 
new/ansi-terminal-1.1.2/CHANGELOG.md
--- old/ansi-terminal-1.0.2/CHANGELOG.md        2024-01-13 18:23:51.000000000 
+0100
+++ new/ansi-terminal-1.1.2/CHANGELOG.md        2024-11-14 00:56:21.000000000 
+0100
@@ -1,6 +1,34 @@
 Changes
 =======
 
+Version 1.1.2
+-------------
+
+* Add `enableLineWrap` and `disableLineWrap`, and support for enabling and
+ disabling automatic line wrapping.
+
+Version 1.1.1
+-------------
+
+* Use of C function `setenv()` in one thread can cause other threads calling C
+  functions that query environment variables to crash. On Unix-like operating
+  systems, where such functions are used, the implementations of
+  `hSupportsANSI` and `hSupportsANSIColor` now avoid unnecessary calls of
+  `System.Environment.lookupEnv`.
+
+* Improvements to Haddock documentation.
+
+Version 1.1
+-----------
+
+* Add support for console layer `Underlining` and underlining styles
+  `CurlyUnderline`, `DottedUnderline` and `DashedUnderline`.
+* Add type synonyms `Parameter`, `SubParam`, and `ParamWithSubs` to represent
+  SGR parameter values with and without following parameter substrings 
comprised
+  of one or more parameter elements (including empty elements).
+* Add `csi'` and `sgrToCode'`, corresponding to `csi` and `sgrToCode` but
+  capable of handling a parameter value followed by a parameter substring.
+
 Version 1.0.2
 -------------
 
@@ -18,11 +46,10 @@
   action can try to enable the processing of \'ANSI\' control characters in
   output.
 * In Windows Terminal and ConHost terminals, `hSupportsANSI` will yield `False`
-  if the the processing of \'ANSI\' control characters in output is not 
enabled.
+  if the processing of \'ANSI\' control characters in output is not enabled.
 * Deprecated `hSupportsANSIWithoutEmulation` is now consistent with
   `hNowSupportsANSI`.
 * Improvements to Haddock documentation.
-
 Version 1.0
 -----------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansi-terminal-1.0.2/LICENSE 
new/ansi-terminal-1.1.2/LICENSE
--- old/ansi-terminal-1.0.2/LICENSE     2023-05-07 12:14:00.000000000 +0200
+++ new/ansi-terminal-1.1.2/LICENSE     2024-02-07 01:15:20.000000000 +0100
@@ -1,22 +1,25 @@
 Copyright (c) 2008, Maximilian Bolingbroke
 All rights reserved.
 
-Redistribution and use in source and binary forms, with or without 
modification, are permitted
-provided that the following conditions are met:
+Redistribution and use in source and binary forms, with or without 
modification,
+are permitted provided that the following conditions are met:
 
-    * Redistributions of source code must retain the above copyright notice, 
this list of
-      conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above copyright 
notice, this list of
-      conditions and the following disclaimer in the documentation and/or 
other materials
-      provided with the distribution.
-    * Neither the name of Maximilian Bolingbroke nor the names of other 
contributors may be used to
-      endorse or promote products derived from this software without specific 
prior written permission.
+* Redistributions of source code must retain the above copyright notice, this
+  list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, 
this
+  list of conditions and the following disclaimer in the documentation and/or
+  other materials provided with the distribution.
+* Neither the name of Maximilian Bolingbroke nor the names of other 
contributors
+  may be used to endorse or promote products derived from this software without
+  specific prior written permission.
 
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
AND ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
MERCHANTABILITY AND
-FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
OF LIABILITY, WHETHER
-IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansi-terminal-1.0.2/README.md 
new/ansi-terminal-1.1.2/README.md
--- old/ansi-terminal-1.0.2/README.md   2024-01-13 17:38:22.000000000 +0100
+++ new/ansi-terminal-1.1.2/README.md   2024-11-14 00:45:05.000000000 +0100
@@ -9,12 +9,13 @@
 
 ['ANSI' terminal escape 
code](http://en.wikipedia.org/wiki/ANSI_escape_sequences)
 support for Haskell, which allows:
--   Colored text output, with control over both foreground and background
-    colors
+-   Colored text output, with control over foreground, background and (where
+    supported) underlining colors
 -   Clearing parts of a line or the screen
 -   Hiding or showing the cursor
 -   Moving the cursor around
 -   Reporting the position of the cursor
+-   Enabling and disabling automatic line wrapping
 -   Scrolling the screen up or down
 -   Switching between the Alternate and Normal Screen Buffers
 -   Clickable hyperlinks to URIs
@@ -40,6 +41,7 @@
 -   Directly changing cursor position: `setCursorColumn` and 
`setCursorPosition`
 -   Saving, restoring and reporting cursor position: `saveCursor`,
     `restoreCursor` and `reportCursorPosition`
+-   Automatic line wrapping: `enableLineWrap` and `disableLineWrap`
 -   Scrolling the screen: `scrollPageUp` and `scrollPageDown`
 -   Changing the title: `setTitle`
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansi-terminal-1.0.2/ansi-terminal.cabal 
new/ansi-terminal-1.1.2/ansi-terminal.cabal
--- old/ansi-terminal-1.0.2/ansi-terminal.cabal 2024-01-13 18:06:54.000000000 
+0100
+++ new/ansi-terminal-1.1.2/ansi-terminal.cabal 2024-11-14 01:02:06.000000000 
+0100
@@ -1,6 +1,6 @@
 Cabal-Version:       1.22
 Name:                ansi-terminal
-Version:             1.0.2
+Version:             1.1.2
 Category:            User Interfaces
 Synopsis:            Simple ANSI terminal support
 Description:         ANSI terminal support for Haskell: allows cursor movement,
@@ -39,7 +39,7 @@
         Other-Modules:          System.Console.ANSI.Internal
 
         Build-Depends:          base >= 4.8.0.0 && < 5
-                              , ansi-terminal-types == 0.11.5
+                              , ansi-terminal-types == 1.1
                               , colour >= 2.1.0
         if os(windows)
             Hs-Source-Dirs:     win
@@ -47,9 +47,6 @@
                                 System.Console.ANSI.Windows.Win32.Types
                                 System.Console.ANSI.Windows.Win32.MinTTY
             Include-Dirs:       win/include
-            Includes:           errors.h
-                                HsWin32.h
-                                winternl_compat.h
             Install-Includes:   HsWin32.h
             C-Sources:          win/c-source/errors.c
                                 win/c-source/HsWin32.c
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansi-terminal-1.0.2/app/Example.hs 
new/ansi-terminal-1.1.2/app/Example.hs
--- old/ansi-terminal-1.0.2/app/Example.hs      2024-01-13 17:15:35.000000000 
+0100
+++ new/ansi-terminal-1.1.2/app/Example.hs      2024-11-14 00:00:13.000000000 
+0100
@@ -18,6 +18,7 @@
            , setCursorPositionExample
            , saveRestoreCursorExample
            , clearExample
+           , lineWrapExample
            , scrollExample
            , screenBuffersExample
            , sgrColorExample
@@ -206,6 +207,24 @@
   pause
   --
 
+lineWrapExample :: IO ()
+lineWrapExample = do
+  putStrLn $ take 240 $ cycle "Default-line-wrap|"
+  pause
+  -- 
Default-line-wrap|Default-line-wrap|Default-line-wrap|Default-line-wrap|Def
+  -- 
ault-line-wrap|Default-line-wrap|Default-line-wrap|Default-line-wrap|Defaul
+  -- 
t-line-wrap|Default-line-wrap|Default-line-wrap|Default-line-wrap|Default-l
+  disableLineWrap
+  putStrLn $ take 240 $ cycle "Disable-line-wrap|"
+  pause
+  -- 
Disable-line-wrap|Disable-line-wrap|Disable-line-wrap|Disable-line-wrap|Dis
+  enableLineWrap
+  putStrLn $ take 240 $ cycle "Enable-line-wrap|"
+  pause
+  -- 
Enable-line-wrap|Enable-line-wrap|Enable-line-wrap|Enable-line-wrap|Enable-
+  -- 
line-wrap|Enable-line-wrap|Enable-line-wrap|Enable-line-wrap|Enable-line-wr
+  -- 
ap|Enable-line-wrap|Enable-line-wrap|Enable-line-wrap|Enable-line-wrap|Enab
+
 scrollExample :: IO ()
 scrollExample = do
   putStrLn "Line One"
@@ -243,15 +262,16 @@
 sgrColorExample :: IO ()
 sgrColorExample = do
   let colors = enumFromTo minBound maxBound :: [Color]
-  forM_ [Foreground, Background] $ \layer ->  do
+  forM_ [Foreground, Background, Underlining] $ \layer ->  do
     forM_ [Dull, Vivid] $ \intensity -> do
       resetScreen
       forM_ colors $ \color -> do
         setSGR [Reset]
         setSGR [SetColor layer intensity color]
+        setSGR [SetUnderlining SingleUnderline]
         print color
       pause
-  -- The ANSI eight standard colors, 4 times in sequence (two layers and two
+  -- The ANSI eight standard colors, 6 times in sequence (three layers and two
   -- intensities)
 
   resetScreen
@@ -333,6 +353,25 @@
         putStr " "
   replicateM_ 5 pause
 
+  resetScreen
+  setSGR [Reset]
+  setSGR [SetUnderlining SingleUnderline]
+  forM_
+    (zip "Underlining: True color (24 bit color depth)" (cycle [0, 10 .. 
255])) $
+    \(c, i) -> do
+      setSGR [SetRGBColor Underlining $ sRGB24 i 0 0]
+      putChar c
+  putChar '\n'
+  putChar '\n'
+  setSGR [Reset]
+  setSGR [SetUnderlining SingleUnderline]
+  forM_ (zip "Underlining: A 256-color palette" (cycle [0 .. 5])) $
+    \(c, i) -> do
+      setSGR [SetPaletteColor Underlining $ xterm6LevelRGB i 0 0]
+      putChar c
+  putChar '\n'
+  replicateM_ 5 pause
+
 sgrOtherExample :: IO ()
 sgrOtherExample = do
   let named_styles = [ (SetConsoleIntensity BoldIntensity, "Bold")
@@ -342,6 +381,9 @@
                      , (SetItalicized False, "No Italics")
                      , (SetUnderlining SingleUnderline, "Single Underline")
                      , (SetUnderlining DoubleUnderline, "Double Underline")
+                     , (SetUnderlining CurlyUnderline, "Curly Underline")
+                     , (SetUnderlining DottedUnderline, "Dotted Underline")
+                     , (SetUnderlining DashedUnderline, "Dashed Underline")
                      , (SetUnderlining NoUnderline, "No Underline")
                      , (SetBlinkSpeed SlowBlink, "Slow Blink")
                      , (SetBlinkSpeed RapidBlink, "Rapid Blink")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansi-terminal-1.0.2/src/System/Console/ANSI/Codes.hs 
new/ansi-terminal-1.1.2/src/System/Console/ANSI/Codes.hs
--- old/ansi-terminal-1.0.2/src/System/Console/ANSI/Codes.hs    2023-12-29 
22:16:13.000000000 +0100
+++ new/ansi-terminal-1.1.2/src/System/Console/ANSI/Codes.hs    2024-11-14 
00:46:36.000000000 +0100
@@ -1,4 +1,5 @@
-{-# LANGUAGE Safe #-}
+{-# LANGUAGE Safe          #-}
+{-# LANGUAGE TupleSections #-}
 
 {-| This module exports functions that return 'String' values containing codes
 in accordance with the \'ANSI\' standards for control character sequences
@@ -34,6 +35,12 @@
   , clearScreenCode, clearFromCursorToLineEndCode
   , clearFromCursorToLineBeginningCode, clearLineCode
 
+    -- * Enabling and disabling automatic line wrapping
+    --
+    -- | These functions control whether or not characters automatically wrap 
to
+    -- the next line when the cursor reaches the right border.
+  , enableLineWrapCode, disableLineWrapCode
+
     -- * Scrolling the screen
     --
     -- | These functions yield @\"\"@ when the number is @0@ as, on some
@@ -54,6 +61,7 @@
   , hideCursorCode, showCursorCode
 
     -- * Hyperlinks
+    --
     -- | Some, but not all, terminals support hyperlinks - that is, clickable
     -- text that points to a URI.
   , hyperlinkCode, hyperlinkWithIdCode, hyperlinkWithParamsCode
@@ -62,7 +70,15 @@
   , setTitleCode
 
     -- * Utilities
-  , colorToCode, csi, osc, sgrToCode
+  , colorToCode
+  , Parameter
+  , SubParam
+  , ParamWithSubs
+  , csi
+  , csi'
+  , osc
+  , sgrToCode
+  , sgrToCode'
   ) where
 
 import Data.Char (isPrint)
@@ -72,16 +88,60 @@
 
 import System.Console.ANSI.Types
 
+-- | Type synonym representing parameter values (without parameter substrings).
+-- To represent a paramater value followed by a parameter substring, see
+-- 'ParamWithSubs'.
+--
+-- @since 1.1
+type Parameter = Int
+
+-- | Type synonym representing parameter elements of a parameter
+-- substring. An empty parameter element (which represents a default value for
+-- the parameter element) has value 'Nothing'.
+--
+-- @since 1.1
+type SubParam = Maybe Int
+
+-- | Type synonym representing parameter values optionally followed by a
+-- parameter substring. Parameter substrings were introduced by 13.1.8 of T.416
+-- (03/93) for SGR parameter values 38 and 48 and have subsequently been 
adapted
+-- for other uses.
+--
+-- @since 1.1
+type ParamWithSubs = (Parameter, [SubParam])
+
 -- | 'csi' @parameters controlFunction@, where @parameters@ is a list of 'Int',
 -- returns the control sequence comprising the control function CONTROL
--- SEQUENCE INTRODUCER (CSI) followed by the parameter(s) (separated by \';\')
+-- SEQUENCE INTRODUCER (CSI) followed by the parameter(s) (separated by 
\'@;@\')
 -- and ending with the @controlFunction@ character(s) that identifies the
--- control function.
+-- control function. See 'csi'' for a function that handles parameter values
+-- that may be followed by a parameter substring.
 csi ::
-     [Int]  -- ^ List of parameters for the control sequence
-  -> String -- ^ Character(s) that identify the control function
+     [Parameter]  -- ^ List of parameters for the control sequence.
+  -> String -- ^ Character(s) that identify the control function.
+  -> String
+csi = renderCsi show
+
+-- | Like 'csi' but extended to parameters that may be followed by a parameter
+-- substring. The parameter elements of a parameter substring are separated 
from
+-- the parameter value and each other by \'@:@\'.
+--
+-- @since 1.1
+csi' ::
+     [ParamWithSubs]
+     -- ^ List of parameters (each of which may be followed by a parameter
+     -- substring).
+  -> String -- ^ Characters(s) that identify the control function.
   -> String
-csi args code = "\ESC[" ++ intercalate ";" (map show args) ++ code
+csi' = renderCsi render
+ where
+  render (p, []) = show p
+  render (p, pes) = intercalate ":" (show p : map (maybe [] show) pes)
+
+-- | Helper function to render different types of parameters.
+renderCsi :: (a -> String) -> [a] -> String -> String
+renderCsi render args code =
+  "\ESC[" ++ intercalate ";" (map render args) ++ code
 
 -- | 'osc' @parameterS parametersT@, where @parameterS@ specifies the type of
 -- operation to perform and @parametersT@ is the other parameter(s) (if any),
@@ -110,43 +170,65 @@
   White   -> 7
 
 -- | 'sgrToCode' @sgr@ returns the parameter of the SELECT GRAPHIC RENDITION
--- (SGR) aspect identified by @sgr@.
+-- (SGR) aspect identified by @sgr@. If the parameter is followed by a 
parameter
+-- substring returns an empty list. See 'sgrToCode'' for a function that 
handles
+-- also parameter values that are followed by a parameter substring.
 sgrToCode ::
      SGR -- ^ The SGR aspect
-  -> [Int]
-sgrToCode sgr = case sgr of
-  Reset -> [0]
+  -> [Parameter]
+sgrToCode sgr = case sgrToCode' sgr of
+  Right args -> args
+  Left _ -> []
+
+-- | 'sgrToCode'' @sgr@ returns the parameter of the SELECT GRAPHIC RENDITION
+-- (SGR) aspect identified by @sgr@.
+--
+-- @since 1.1
+sgrToCode' ::
+     SGR -- ^ The SGR aspect
+  -> Either ParamWithSubs [Parameter]
+sgrToCode' sgr = case sgr of
+  Reset -> Right [0]
   SetConsoleIntensity intensity -> case intensity of
-    BoldIntensity   -> [1]
-    FaintIntensity  -> [2]
-    NormalIntensity -> [22]
-  SetItalicized True  -> [3]
-  SetItalicized False -> [23]
+    BoldIntensity   -> Right [1]
+    FaintIntensity  -> Right [2]
+    NormalIntensity -> Right [22]
+  SetItalicized True  -> Right [3]
+  SetItalicized False -> Right [23]
   SetUnderlining underlining -> case underlining of
-    SingleUnderline -> [4]
-    DoubleUnderline -> [21]
-    NoUnderline     -> [24]
+    SingleUnderline -> Right [4]
+    DoubleUnderline -> Right [21]
+    CurlyUnderline -> Left (4, [Just 3])
+    DottedUnderline -> Left (4, [Just 4])
+    DashedUnderline -> Left (4, [Just 5])
+    NoUnderline     -> Right [24]
   SetBlinkSpeed blink_speed -> case blink_speed of
-    SlowBlink   -> [5]
-    RapidBlink  -> [6]
-    NoBlink     -> [25]
-  SetVisible False -> [8]
-  SetVisible True  -> [28]
-  SetSwapForegroundBackground True  -> [7]
-  SetSwapForegroundBackground False -> [27]
-  SetColor Foreground Dull color  -> [30 + colorToCode color]
-  SetColor Foreground Vivid color -> [90 + colorToCode color]
-  SetColor Background Dull color  -> [40 + colorToCode color]
-  SetColor Background Vivid color -> [100 + colorToCode color]
-  SetPaletteColor Foreground index -> [38, 5, fromIntegral index]
-  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]
+    SlowBlink   -> Right [5]
+    RapidBlink  -> Right [6]
+    NoBlink     -> Right [25]
+  SetVisible False -> Right [8]
+  SetVisible True  -> Right [28]
+  SetSwapForegroundBackground True  -> Right [7]
+  SetSwapForegroundBackground False -> Right [27]
+  SetColor Foreground Dull color  -> Right [30 + colorToCode color]
+  SetColor Foreground Vivid color -> Right [90 + colorToCode color]
+  SetColor Background Dull color  -> Right [40 + colorToCode color]
+  SetColor Background Vivid color -> Right [100 + colorToCode color]
+  SetColor Underlining Dull color  -> Left (58, [Just 5, Just $ colorToCode 
color])
+  SetColor Underlining Vivid color -> Left (58, [Just 5, Just $ 8 + 
colorToCode color])
+  SetPaletteColor Foreground index -> Right [38, 5, fromIntegral index]
+  SetPaletteColor Background index -> Right [48, 5, fromIntegral index]
+  SetPaletteColor Underlining index -> Left (58, [Just 5, Just $ fromIntegral 
index])
+  SetRGBColor Foreground color -> Right $ [38, 2] ++ toRGB color
+  SetRGBColor Background color -> Right $ [48, 2] ++ toRGB color
+  SetRGBColor Underlining color -> Left (58, [Just 2, Nothing] ++ toRGB' color)
+  SetDefaultColor Foreground -> Right [39]
+  SetDefaultColor Background -> Right [49]
+  SetDefaultColor Underlining -> Right [59]
  where
   toRGB color = let RGB r g b = toSRGB24 color
                 in  map fromIntegral [r, g, b]
+  toRGB' = map Just . toRGB
 
 cursorUpCode, cursorDownCode, cursorForwardCode, cursorBackwardCode ::
      Int -- ^ Number of lines or characters to move
@@ -198,9 +280,11 @@
 reportCursorPositionCode :: String
 reportCursorPositionCode = csi [] "6n"
 
--- | Code to emit the layer color into the console input stream, immediately
--- after being recognised on the output stream, as:
+-- | Code to emit the foreground or backgrond layer color into the console 
input
+-- stream, immediately after being recognised on the output stream, as:
+--
 -- @ESC ] \<Ps> ; rgb: \<red> ; \<green> ; \<blue> \<ST>@
+--
 -- where @\<Ps>@ is @10@ for 'Foreground' and @11@ for 'Background'; @\<red>@,
 -- @\<green>@ and @\<blue>@ are the color channel values in hexadecimal (4, 8,
 -- 12 and 16 bit values are possible, although 16 bit values are most common);
@@ -212,10 +296,13 @@
 -- terminals (2) of difficulties in obtaining the data emitted into the
 -- console input stream. See 'System.Console.ANSI.getReportedLayerColor'.
 --
+-- Underlining is not supported.
+--
 -- @since 0.11.4
 reportLayerColorCode :: ConsoleLayer -> String
 reportLayerColorCode Foreground = osc "10" "?"
 reportLayerColorCode Background = osc "11" "?"
+reportLayerColorCode Underlining = [] -- Not supported.
 
 clearFromCursorToScreenEndCode, clearFromCursorToScreenBeginningCode,
   clearScreenCode :: String
@@ -229,6 +316,10 @@
 clearFromCursorToLineBeginningCode = csi [1] "K"
 clearLineCode = csi [2] "K"
 
+enableLineWrapCode, disableLineWrapCode :: String
+enableLineWrapCode = csi [] "?7h"
+disableLineWrapCode = csi [] "?7l"
+
 scrollPageUpCode, scrollPageDownCode ::
      Int -- ^ Number of lines to scroll by
   -> String
@@ -245,7 +336,9 @@
      -- console SGR mode. An empty list of commands is equivalent to the list
      -- @[Reset]@. Commands are applied left to right.
   -> String
-setSGRCode sgrs = csi (concatMap sgrToCode sgrs) "m"
+setSGRCode sgrs = csi' (concatMap sgrToCode'' sgrs) "m"
+ where
+  sgrToCode'' = either (:[]) (map (,[] :: [SubParam])) . sgrToCode'
 
 hideCursorCode, showCursorCode :: String
 hideCursorCode = csi [] "?25l"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansi-terminal-1.0.2/src/System/Console/ANSI.hs 
new/ansi-terminal-1.1.2/src/System/Console/ANSI.hs
--- old/ansi-terminal-1.0.2/src/System/Console/ANSI.hs  2024-01-13 
17:41:40.000000000 +0100
+++ new/ansi-terminal-1.1.2/src/System/Console/ANSI.hs  2024-11-14 
00:46:36.000000000 +0100
@@ -10,7 +10,8 @@
 codes) provide a rich range of functionality for terminal control, which
 includes:
 
- * Colored text output, with control over both foreground and background colors
+ * Colored text output, with control over foreground, background and (where
+   supported) underlining colors
 
  * Clearing parts of a line or the screen
 
@@ -20,6 +21,8 @@
 
  * Reporting the position of the cursor
 
+ * Enabling or disabling automatic line wrapping
+
  * Scrolling the screen up or down
 
  * Switching between the Alternate and Normal Screen Buffers
@@ -83,9 +86,9 @@
 GHC's management of input and output (IO) on Windows has also developed over
 time. If they are supported by the terminal software, some control character
 sequences cause data to be emitted into the console input stream. For GHC's
-historical and default IO manager, the function 'hGetBufNonBlocking' in module
-"System.IO" does not work on Windows. This has been attributed to the lack of
-non-blocking primatives in the operating system (see
+historical and default IO manager, the function 'System.IO.hGetBufNonBlocking'
+in module "System.IO" does not work on Windows. This has been attributed to the
+lack of non-blocking primatives in the operating system (see
   [GHC bug report #806](https://ghc.haskell.org/trac/ghc/ticket/806). GHC's
 native IO manager on Windows (\'WinIO\'), introduced as a preview in
   [GHC 
9.0.1](https://downloads.haskell.org/ghc/9.0.1/docs/html/users_guide/9.0.1-notes.html#highlights),
@@ -196,6 +199,7 @@
   , cursorBackwardCode
 
     -- * Cursor movement by line
+    --
     -- | The difference between movements \"by character\" and \"by line\" is
     -- that @*Line@ functions additionally move the cursor to the start of the
     -- line, while functions like @cursorUp@ and @cursorDown@ keep the column
@@ -220,6 +224,7 @@
   , setCursorPositionCode
 
     -- * Saving, restoring and reporting cursor position
+    --
     -- | These code sequences are not part of ECMA-48 standard; they are 
popular,
     -- but non-portable extensions. E. g., Terminal.app on MacOS
     -- <https://stackoverflow.com/questions/25879183 does not support them>.
@@ -242,6 +247,7 @@
   , reportCursorPositionCode
 
     -- * Clearing parts of the screen
+    --
     -- | Note that these functions only clear parts of the screen. They do not
     -- move the cursor. Some functions are based on the whole screen and others
     -- are based on the line in which the cursor is located.
@@ -266,6 +272,19 @@
   , clearFromCursorToLineBeginningCode
   , clearLineCode
 
+    -- * Enabling and disabling automatic line wrapping
+    --
+    -- | These functions control whether or not characters automatically wrap 
to
+    -- the next line when the cursor reaches the right border.
+  , enableLineWrap
+  , disableLineWrap
+    -- ** \'h...\' variants
+  , hEnableLineWrap
+  , hDisableLineWrap
+    -- ** \'...Code\' variants
+  , enableLineWrapCode
+  , disableLineWrapCode
+
     -- * Scrolling the screen
   , scrollPageUp
   , scrollPageDown
@@ -277,6 +296,7 @@
   , scrollPageDownCode
 
     -- * Using screen buffers
+    --
     -- | These code sequences are not part of ECMA-48 standard; they are 
popular,
     -- but non-portable extensions, corresponding to @smcup@ and @rmcup@ 
capabilities
     -- in @terminfo@ database.
@@ -302,6 +322,7 @@
   , setSGRCode
 
     -- * Cursor visibilty changes
+    --
     -- | Strictly speaking, these code sequences are not part of ECMA-48 
standard;
     -- they are popular, but non-portable extensions. However, in practice 
they seem
     -- to work pretty much everywhere.
@@ -315,6 +336,7 @@
   , showCursorCode
 
     -- * Hyperlinks
+    --
     -- | These code sequences are not part of ECMA-48 standard and not even an
     -- @xterm@ extension. Nevertheless
     -- <https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda 
many terminals>
@@ -367,7 +389,6 @@
 import Data.Char ( digitToInt, isDigit, isHexDigit )
 import Data.Colour.SRGB ( RGB (..) )
 import Data.Word ( Word16 )
-import System.Environment ( getEnvironment )
 import System.IO
          ( BufferMode (..), Handle, hFlush, hGetBuffering, hGetEcho, hPutStr
          , hReady, hSetBuffering, hSetEcho, stdin, stdout
@@ -600,7 +621,7 @@
 -- will work with a given handle.
 --
 -- If the handle is not writable (that is, it cannot manage output - see
--- 'hIsWritable'), then @pure False@ is returned.
+-- 'System.IO.hIsWritable'), then @pure False@ is returned.
 --
 -- For Unix-like operating systems, the current implementation checks
 -- that: (1) the handle is a terminal; and (2) a @TERM@ environment variable is
@@ -611,12 +632,12 @@
 -- a terminal, (2) a @TERM@ environment variable is not set to @dumb@, and (3)
 -- the processing of \'ANSI\' control characters in output is enabled; and
 -- second, as an alternative, whether the handle is connected to a \'mintty\'
--- terminal. (That is because the function 'hIsTerminalDevice' is used to check
--- if the handle is a terminal. However, where a non-native Windows terminal
--- (such as \'mintty\') is implemented using redirection, that function will 
not
--- identify a handle to the terminal as a terminal.) If it is not already
--- enabled, this function does *not* enable the processing of \'ANSI\' control
--- characters in output (see 'hNowSupportsANSI').
+-- terminal. (That is because the function 'System.IO.hIsTerminalDevice' is 
used
+-- to check if the handle is a terminal. However, where a non-native Windows
+-- terminal (such as \'mintty\') is implemented using redirection, that 
function
+-- will not identify a handle to the terminal as a terminal.) If it is not
+-- already enabled, this function does *not* enable the processing of \'ANSI\'
+-- control characters in output (see 'hNowSupportsANSI').
 --
 -- @since 0.6.2
 hSupportsANSI :: Handle -> IO Bool
@@ -637,11 +658,7 @@
 --
 -- @since 0.9
 hSupportsANSIColor :: Handle -> IO Bool
-hSupportsANSIColor h = (||) <$> hSupportsANSI h <*> isEmacsTerm
-  where
-    isEmacsTerm = (\env -> insideEmacs env && isDumb env) <$> getEnvironment
-    insideEmacs = any (\(k, _) -> k == "INSIDE_EMACS")
-    isDumb env = Just "dumb" == lookup "TERM" env
+hSupportsANSIColor = Internal.hSupportsANSIColor
 
 -- | Use heuristics to determine whether a given handle will support \'ANSI\'
 -- control characters in output. The function is consistent with
@@ -787,6 +804,8 @@
 -- emulated, but the emulation does not work on Windows Terminal and (2) of
 -- difficulties in obtaining the data emitted into the console input stream.
 --
+-- Underlining is not supported.
+--
 -- @since 0.11.4
 reportLayerColor :: ConsoleLayer -> IO ()
 reportLayerColor = hReportLayerColor stdout
@@ -818,6 +837,8 @@
 -- as mintty, that are not based on the Windows' Console API. (Command Prompt
 -- and PowerShell are based on the Console API.)
 --
+-- Underlining is not supported.
+--
 -- @since 0.11.4
 getReportedLayerColor :: ConsoleLayer -> IO String
 getReportedLayerColor = Internal.getReportedLayerColor
@@ -835,6 +856,8 @@
 -- and PowerShell are based on the Console API.) This function also relies on
 -- emulation that does not work on Windows Terminal.
 --
+-- Underlining is not supported.
+--
 -- @since 0.11.4
 getLayerColor :: ConsoleLayer -> IO (Maybe(RGB Word16))
 getLayerColor = hGetLayerColor stdout
@@ -851,6 +874,8 @@
 -- and PowerShell are based on the Console API.) This function also relies on
 -- emulation that does not work on Windows Terminal.
 --
+-- Underlining is not supported.
+--
 -- @since 0.11.4
 hGetLayerColor :: Handle -> ConsoleLayer -> IO (Maybe (RGB Word16))
 hGetLayerColor h layer = do
@@ -890,6 +915,8 @@
 -- >     [(col, _)] -> putStrLn $ "The color was " ++ show col ++ "."
 -- >     (_:_) -> putStrLn $ "Error: parse not unique"
 --
+-- Underlining is not supported.
+--
 -- @since 0.11.4
 layerColor :: ConsoleLayer -> ReadP (RGB Word16)
 layerColor layer = do
@@ -897,6 +924,7 @@
   void $ string $ case layer of
     Foreground -> "10"
     Background -> "11"
+    Underlining -> fail "reportLayerColor does not support underlining"
   void $ string ";rgb:"
   redHex <- hexadecimal -- A non-negative whole hexadecimal number
   void $ char '/'
@@ -948,7 +976,7 @@
 
 -- | 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').
+-- (which will typically be 'stdout' or 'System.IO.stderr').
 --
 -- There is no \'ANSI\' control character sequence that reports the terminal
 -- size. So, it attempts to set the cursor position beyond the bottom right
@@ -1021,6 +1049,16 @@
 clearFromCursorToLineBeginning = hClearFromCursorToLineBeginning stdout
 clearLine = hClearLine stdout
 
+hEnableLineWrap, hDisableLineWrap ::
+     Handle
+  -> IO ()
+hEnableLineWrap h = hPutStr h enableLineWrapCode
+hDisableLineWrap h = hPutStr h disableLineWrapCode
+
+enableLineWrap, disableLineWrap :: IO ()
+enableLineWrap = hEnableLineWrap stdout
+disableLineWrap = hDisableLineWrap stdout
+
 hScrollPageUp, hScrollPageDown ::
      Handle
   -> Int -- Number of lines to scroll by
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ansi-terminal-1.0.2/unix/System/Console/ANSI/Internal.hs 
new/ansi-terminal-1.1.2/unix/System/Console/ANSI/Internal.hs
--- old/ansi-terminal-1.0.2/unix/System/Console/ANSI/Internal.hs        
2024-01-13 17:15:35.000000000 +0100
+++ new/ansi-terminal-1.1.2/unix/System/Console/ANSI/Internal.hs        
2024-04-24 00:27:08.000000000 +0200
@@ -1,16 +1,18 @@
-{-# LANGUAGE Safe #-}
+{-# LANGUAGE Trustworthy #-}
 
 module System.Console.ANSI.Internal
   ( getReportedCursorPosition
   , getReportedLayerColor
   , hSupportsANSI
   , hNowSupportsANSI
+  , hSupportsANSIColor
   ) where
 
 import Data.List ( uncons )
-import Data.Maybe ( fromMaybe, mapMaybe )
+import Data.Maybe ( fromMaybe, isJust, mapMaybe )
 import System.Environment ( lookupEnv )
 import System.IO ( Handle, hIsTerminalDevice, hIsWritable )
+import System.IO.Unsafe ( unsafePerformIO )
 import System.Timeout ( timeout )
 
 import System.Console.ANSI.Types ( ConsoleLayer (..) )
@@ -19,6 +21,8 @@
 getReportedCursorPosition = getReport "\ESC[" ["R"]
 
 getReportedLayerColor :: ConsoleLayer -> IO String
+getReportedLayerColor Underlining =
+  error "getReportedLayerColor does not support underlining."
 getReportedLayerColor layer =
   getReport ("\ESC]" ++ pS ++ ";rgb:") ["\BEL", "\ESC\\"]
  where
@@ -72,8 +76,34 @@
 -- 
(https://github.com/hspec/hspec/commit/d932f03317e0e2bd08c85b23903fb8616ae642bd)
 hSupportsANSI h = (&&) <$> hIsWritable h <*> hSupportsANSI'
  where
-  hSupportsANSI' = (&&) <$> hIsTerminalDevice h <*> isNotDumb
-  isNotDumb = (/= Just "dumb") <$> lookupEnv "TERM"
+  hSupportsANSI' = (&& isNotDumb) <$> hIsTerminalDevice h
 
 hNowSupportsANSI :: Handle -> IO Bool
 hNowSupportsANSI = hSupportsANSI
+
+hSupportsANSIColor :: Handle -> IO Bool
+hSupportsANSIColor h = (|| isEmacsTerm) <$> hSupportsANSI h
+ where
+  isEmacsTerm = insideEmacs && isDumb
+  isDumb = not isNotDumb
+
+-- | This function assumes that once it is first established whether or not the
+-- TERM environment variable exists with contents dumb, that will not change.
+-- This approach is taken because the use of C function setenv() in one thread
+-- can cause other threads calling C function getenv() to crash. On Unix-like
+-- operating systems, System.Environment.lookupEnv is implemented using C
+-- function getenv(). 
+isNotDumb :: Bool
+isNotDumb = unsafePerformIO (lookupEnv "TERM") /= Just "dumb"
+
+{-# NOINLINE isNotDumb #-}
+
+-- | This function assumes that once it is first established whether or not the
+-- INSIDE_EMACS environment variable exists, that will not change. This 
approach
+-- is taken because the use of C function setenv() in one thread can cause 
other
+-- threads calling C function getenv() to crash. On Unix-like operating 
systems,
+-- System.Environment.lookupEnv is implemented using C function getenv(). 
+insideEmacs :: Bool
+insideEmacs = isJust $ unsafePerformIO (lookupEnv "INSIDE_EMACS")
+
+{-# NOINLINE insideEmacs #-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ansi-terminal-1.0.2/win/System/Console/ANSI/Internal.hs 
new/ansi-terminal-1.1.2/win/System/Console/ANSI/Internal.hs
--- old/ansi-terminal-1.0.2/win/System/Console/ANSI/Internal.hs 2024-01-13 
17:15:35.000000000 +0100
+++ new/ansi-terminal-1.1.2/win/System/Console/ANSI/Internal.hs 2024-04-24 
00:27:08.000000000 +0200
@@ -5,12 +5,13 @@
   , getReportedLayerColor
   , hNowSupportsANSI
   , hSupportsANSI
+  , hSupportsANSIColor
   ) where
 
 import Control.Exception ( IOException, SomeException, catch, try )
 import Data.Bits ( (.&.), (.|.) )
 import Data.Maybe ( mapMaybe )
-import System.Environment ( lookupEnv )
+import System.Environment ( getEnvironment, lookupEnv )
 import System.IO ( Handle, hIsTerminalDevice, hIsWritable, stdin )
 import System.Console.ANSI.Types ( ConsoleLayer )
 
@@ -103,3 +104,10 @@
   if h == iNVALID_HANDLE_VALUE || h == nullHANDLE
     then invalid  -- Invalid handle or no handle
     else action h
+
+hSupportsANSIColor :: Handle -> IO Bool
+hSupportsANSIColor h = (||) <$> hSupportsANSI h <*> isEmacsTerm
+  where
+    isEmacsTerm = (\env -> insideEmacs env && isDumb env) <$> getEnvironment
+    insideEmacs = any (\(k, _) -> k == "INSIDE_EMACS")
+    isDumb env = Just "dumb" == lookup "TERM" env

Reply via email to