king: New dependency: ansi-terminal

This commit is contained in:
Benjamin Summers 2020-02-19 08:01:51 -08:00 committed by Jared Tobin
parent 3b1bd6600a
commit a318462836
No known key found for this signature in database
GPG Key ID: 0E4647D58F8A69E4
3 changed files with 28 additions and 3 deletions

View File

@ -402,8 +402,8 @@ localClient doneSignal = fst <$> mkRAcquire start stop
-- Redraw the current LineState, maintaining the current curpos
termRefreshLine :: T.Terminal -> LineState -> RIO e LineState
termRefreshLine t ls = do
let line = (lsLine ls)
curPos = (lsCurPos ls)
let line = lsLine ls
curPos = lsCurPos ls
ls <- termShowClear t ls
ls <- termShowLine t ls line
termShowCursor t ls curPos
@ -559,7 +559,6 @@ term (tsize, Client{..}) shutdownSTM king enqueueEv =
atomically $ give [Term.Blits termBlits]
for_ fsWrites handleFsWrite
handleFsWrite :: Blit -> RIO e ()
handleFsWrite (Sag path noun) = performPut path (jamBS noun)
handleFsWrite (Sav path atom) = performPut path (atomBytes atom)

View File

@ -12,12 +12,18 @@ module Urbit.Vere.Term.Render
, setupTermFromEnv
, getCapability
, tiGetOutput1
, clearScreen
, clearLine
, cursorRight
, cursorLeft
, soundBell
) where
import ClassyPrelude
import qualified System.Console.Terminal.Size as TSize
import qualified System.Console.Terminfo.Base as TInfo
import qualified System.Console.ANSI as ANSI
--------------------------------------------------------------------------------
@ -51,6 +57,8 @@ termText = TInfo.termText
runTermOutput Terminal -> TermOutput -> IO ()
runTermOutput = TInfo.runTermOutput
-- Deprecated ------------------------------------------------------------------
setupTermFromEnv IO Terminal
setupTermFromEnv = TInfo.setupTermFromEnv
@ -59,3 +67,20 @@ getCapability = TInfo.getCapability
tiGetOutput1 TInfo.OutputCap f => String -> Capability f
tiGetOutput1 = TInfo.tiGetOutput1
--------------------------------------------------------------------------------
clearScreen IO ()
clearScreen = ANSI.clearScreen
clearLine IO ()
clearLine = ANSI.clearLine
soundBell IO ()
soundBell = putStr "\BEL"
cursorLeft IO ()
cursorLeft = ANSI.cursorBackward 1
cursorRight IO ()
cursorRight = ANSI.cursorForward 1

View File

@ -30,6 +30,7 @@ tests:
dependencies:
- aeson
- ansi-terminal
- async
- base
- base-unicode-symbols