summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/Terminal.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/main/Terminal.hs b/main/Terminal.hs
index b516f93..53814f9 100644
--- a/main/Terminal.hs
+++ b/main/Terminal.hs
@@ -15,6 +15,7 @@ module Terminal (
printLine,
updateLine,
updateLinePart,
+ eraseLinesSince,
printBottomLines,
clearBottomLines,
@@ -422,6 +423,15 @@ updateLinePart TerminalLine {..} offset str = do
, AnsiText $ "\ESC[u"
]
+eraseLinesSince :: TerminalLine -> IO ()
+eraseLinesSince TerminalLine {..} = do
+ let Terminal {..} = tlTerminal
+ when termAnsi $ do
+ withMVar termLock $ \_ -> do
+ bindex <- atomically $ readTVar termBottomIndex
+ putAnsi $ AnsiText $ "\ESC[" <> T.pack (show (bindex - tlLineIndex)) <> "F\ESC[J"
+ atomically $ writeTVar termBottomIndex tlLineIndex
+
printBottomLines :: Terminal -> String -> IO ()
printBottomLines Terminal { termAnsi = False } _ = do