Created
December 18, 2021 01:17
-
-
Save slice/cc43a5061db7a8da2660d81c60030672 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/libraries/terminfo/Changelog b/libraries/terminfo/Changelog | |
index ed84923..c1ebbdb 100644 | |
--- a/libraries/terminfo/Changelog | |
+++ b/libraries/terminfo/Changelog | |
@@ -1,3 +1,6 @@ | |
+Changed in version 0.4.1.5: | |
+- Use CAPI for `tparm` to fix behavior on Apple Silicon (#41). | |
+ | |
Changed in version 0.4.1.4: | |
- Bump the upper bound to allow `base-4.13` (`ghc-8.8`). | |
diff --git a/libraries/terminfo/System/Console/Terminfo/Base.hs b/libraries/terminfo/System/Console/Terminfo/Base.hs | |
index 7b15dbb..10d00a9 100644 | |
--- a/libraries/terminfo/System/Console/Terminfo/Base.hs | |
+++ b/libraries/terminfo/System/Console/Terminfo/Base.hs | |
@@ -1,3 +1,4 @@ | |
+{-# LANGUAGE CApiFFI #-} | |
{-# LANGUAGE DeriveDataTypeable #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
@@ -70,6 +71,10 @@ foreign import ccall setupterm :: CString -> CInt -> Ptr CInt -> IO () | |
-- | Initialize the terminfo library to the given terminal entry. | |
-- | |
-- Throws a 'SetupTermError' if the terminfo database could not be read. | |
+-- | |
+-- *Note:* @ncurses@ is not thread-safe; initializing or using multiple | |
+-- 'Terminal's in different threads at the same time can result in memory | |
+-- unsafety. | |
setupTerm :: String -> IO Terminal | |
setupTerm term = | |
withCString term $ \c_term -> | |
@@ -259,8 +264,8 @@ tiGetStr cap = Capability $ const $ do | |
-foreign import ccall tparm :: | |
- CString -> CLong -> CLong -> CLong -> CLong -> CLong -> CLong | |
+foreign import capi "term.h tparm" | |
+ tparm :: CString -> CLong -> CLong -> CLong -> CLong -> CLong -> CLong | |
-> CLong -> CLong -> CLong -- p1,...,p9 | |
-> IO CString | |
diff --git a/libraries/terminfo/terminfo.cabal b/libraries/terminfo/terminfo.cabal | |
index 1243d58..e9ad821 100644 | |
--- a/libraries/terminfo/terminfo.cabal | |
+++ b/libraries/terminfo/terminfo.cabal | |
@@ -1,6 +1,6 @@ | |
Name: terminfo | |
Cabal-Version: >=1.10 | |
-Version: 0.4.1.4 | |
+Version: 0.4.1.5 | |
Category: User Interfaces | |
License: BSD3 | |
License-File: LICENSE | |
@@ -28,7 +28,7 @@ Library | |
other-extensions: CPP, DeriveDataTypeable, FlexibleInstances, ScopedTypeVariables | |
if impl(ghc>=7.3) | |
other-extensions: Safe, Trustworthy | |
- build-depends: base >= 4.9 && < 4.15 | |
+ build-depends: base >= 4.9 && < 4.17 | |
ghc-options: -Wall | |
exposed-modules: | |
System.Console.Terminfo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment