diff --git a/pkg/hs/urbit-king/lib/Urbit/Vere/Term.hs b/pkg/hs/urbit-king/lib/Urbit/Vere/Term.hs index 1a48c1a8fd..b698f6b2ba 100644 --- a/pkg/hs/urbit-king/lib/Urbit/Vere/Term.hs +++ b/pkg/hs/urbit-king/lib/Urbit/Vere/Term.hs @@ -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) diff --git a/pkg/hs/urbit-king/lib/Urbit/Vere/Term/Render.hs b/pkg/hs/urbit-king/lib/Urbit/Vere/Term/Render.hs index 4accf2e06d..dfad2e067f 100644 --- a/pkg/hs/urbit-king/lib/Urbit/Vere/Term/Render.hs +++ b/pkg/hs/urbit-king/lib/Urbit/Vere/Term/Render.hs @@ -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 diff --git a/pkg/hs/urbit-king/package.yaml b/pkg/hs/urbit-king/package.yaml index 21aa63eefc..c8233891cb 100644 --- a/pkg/hs/urbit-king/package.yaml +++ b/pkg/hs/urbit-king/package.yaml @@ -30,6 +30,7 @@ tests: dependencies: - aeson + - ansi-terminal - async - base - base-unicode-symbols