summaryrefslogtreecommitdiff
path: root/main/Terminal.hs
diff options
context:
space:
mode:
Diffstat (limited to 'main/Terminal.hs')
-rw-r--r--main/Terminal.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/main/Terminal.hs b/main/Terminal.hs
index 3e3864b..89444e6 100644
--- a/main/Terminal.hs
+++ b/main/Terminal.hs
@@ -165,13 +165,14 @@ getInputLine term@Terminal {..} handleResult = do
writeTVar termHistory . addLine =<< readTVar termHistory
writeTVar termHistoryPos 0
- ( x, c ) <- case handleResult mbLine of
- KeepPrompt x -> return ( x, AnsiText "\n" )
- ErasePrompt x -> return ( x, AnsiText "\r" )
+ ( x, clear ) <- case handleResult mbLine of
+ KeepPrompt x -> return ( x, \statusLen -> AnsiText $ "\ESC[" <> T.pack (show statusLen) <> "G\ESC[1K\n\ESC[J" )
+ ErasePrompt x -> return ( x, \_ -> AnsiText "\r\ESC[J" )
when termAnsi $ do
withMVar termLock $ \_ -> do
+ status <- atomically $ readTVar termPromptStatus
prompt <- atomically $ getCurrentPromptLine term
- putAnsi $ c <> AnsiText "\ESC[J" <> prompt
+ putAnsi $ clear (formattedTextLength status) <> prompt
return x
where