summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2025-03-27 22:01:39 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2025-03-27 22:01:39 +0100
commitf739541b7e9ef680cc6473d0303f6e1892ddc4f7 (patch)
tree984f1d4a4674082feff296f3aa5aed8b581ba033
parentc536547d742cde13042792e60f28893578adc331 (diff)
Build with ansi-terminal-0.11devel
Present in Debian bookworm.
-rw-r--r--erebos.cabal2
-rw-r--r--main/Terminal.hs6
2 files changed, 7 insertions, 1 deletions
diff --git a/erebos.cabal b/erebos.cabal
index ba23d0b..aa16899 100644
--- a/erebos.cabal
+++ b/erebos.cabal
@@ -196,7 +196,7 @@ executable erebos
Paths_erebos
build-depends:
- ansi-terminal ^>= { 1.1.2 },
+ ansi-terminal ^>= { 0.11, 1.0, 1.1 },
bytestring,
crypton,
directory,
diff --git a/main/Terminal.hs b/main/Terminal.hs
index 63b8ea2..5dc3612 100644
--- a/main/Terminal.hs
+++ b/main/Terminal.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE CPP #-}
+
module Terminal (
Terminal,
hasTerminalUI,
@@ -72,7 +74,11 @@ hasTerminalUI = termAnsi
initTerminal :: CompletionFunc IO -> IO Terminal
initTerminal termCompletionFunc = do
termLock <- newMVar ()
+#if MIN_VERSION_ansi_terminal(1, 0, 1)
termAnsi <- hNowSupportsANSI stdout
+#else
+ termAnsi <- hSupportsANSI stdout
+#endif
termPrompt <- newTVarIO ""
termShowPrompt <- newTVarIO False
termInput <- newTVarIO ( "", "" )