diff options
| author | Ben Sima <ben@bsima.me> | 2025-11-14 15:39:38 -0500 |
|---|---|---|
| committer | Ben Sima <ben@bsima.me> | 2025-11-14 15:42:46 -0500 |
| commit | 669dd3a1ab6c72d530c6480afa1ee54f2353c8a6 (patch) | |
| tree | 0276d62f5a1aa85093ff404742c4061181f06f4b /Omni | |
| parent | 214c13a88550cc981b59dd45f564390f2b965940 (diff) | |
Fix prompt preservation and cleanup extra lines at end
- Add initial newline to preserve terminal prompt - Clear each line
individually at end instead of just moving cursor - This prevents
extra blank lines from remaining on screen
Diffstat (limited to 'Omni')
| -rw-r--r-- | Omni/Log/Concurrent.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Omni/Log/Concurrent.hs b/Omni/Log/Concurrent.hs index 4ed8f42..391fcff 100644 --- a/Omni/Log/Concurrent.hs +++ b/Omni/Log/Concurrent.hs @@ -71,6 +71,7 @@ withLineManager maxLines action = do writeIORef namespaceLines Map.empty pure result else do + IO.hPutStrLn IO.stderr "" replicateM_ maxLines (IO.hPutStrLn IO.stderr "") ANSI.hCursorUp IO.stderr maxLines @@ -88,7 +89,11 @@ withLineManager maxLines action = do result <- action mgr - ANSI.hCursorDown IO.stderr maxLines + forM_ [0 .. maxLines - 1] <| \_ -> do + ANSI.hCursorDown IO.stderr 1 + ANSI.hSetCursorColumn IO.stderr 0 + ANSI.hClearLine IO.stderr + writeIORef currentLineManager Nothing writeIORef namespaceLines Map.empty pure result |
