diff options
| author | Roman Smrž <roman.smrz@seznam.cz> | 2026-05-31 19:54:12 +0200 |
|---|---|---|
| committer | Roman Smrž <roman.smrz@seznam.cz> | 2026-05-31 20:10:37 +0200 |
| commit | 0d5c0e31b9e0cbaa0c97b4ea6e55ddbdae689660 (patch) | |
| tree | 9d7219edcda01cbd8254b7cfb8a31638467bbf46 /main/Terminal.hs | |
| parent | 78cb2c00fc45144fba7486bf7bd2f3f202d66037 (diff) | |
Diffstat (limited to 'main/Terminal.hs')
| -rw-r--r-- | main/Terminal.hs | 10 |
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 |