clear progress bar before displaying messages

In particular this clears it before "transfer stalled". If an external
special remote uses showInfo while progress is displayed, it will also
improve display of that.

Generally this will avoid all such problems in the future..

Sponsored-by: Svenne Krap on Patreon
This commit is contained in:
Joey Hess 2021-06-15 20:43:00 -04:00
parent e055ffe18e
commit 7c7225e257
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 9 additions and 7 deletions

View file

@ -124,14 +124,12 @@ showSideAction m = Annex.getState Annex.output >>= go
where where
go st go st
| sideActionBlock st == StartBlock = do | sideActionBlock st == StartBlock = do
go' st go'
let st' = st { sideActionBlock = InBlock } let st' = st { sideActionBlock = InBlock }
Annex.changeState $ \s -> s { Annex.output = st' } Annex.changeState $ \s -> s { Annex.output = st' }
| sideActionBlock st == InBlock = return () | sideActionBlock st == InBlock = return ()
| otherwise = go' st | otherwise = go'
go' st = do go' = outputMessage JSON.none $ encodeBS' $ "(" ++ m ++ "...)\n"
liftIO $ clearProgressMeter st
outputMessage JSON.none $ encodeBS' $ "(" ++ m ++ "...)\n"
showStoringStateAction :: Annex () showStoringStateAction :: Annex ()
showStoringStateAction = showSideAction "recording state in git" showStoringStateAction = showSideAction "recording state in git"

View file

@ -25,8 +25,12 @@ outputMessage = outputMessage' bufferJSON
outputMessage' :: (JSONBuilder -> MessageState -> Annex Bool) -> JSONBuilder -> S.ByteString -> Annex () outputMessage' :: (JSONBuilder -> MessageState -> Annex Bool) -> JSONBuilder -> S.ByteString -> Annex ()
outputMessage' jsonoutputter jsonbuilder msg = withMessageState $ \s -> case outputType s of outputMessage' jsonoutputter jsonbuilder msg = withMessageState $ \s -> case outputType s of
NormalOutput NormalOutput
| concurrentOutputEnabled s -> concurrentMessage s False (decodeBS msg) q | concurrentOutputEnabled s -> do
| otherwise -> liftIO $ flushed $ S.putStr msg liftIO $ clearProgressMeter s
concurrentMessage s False (decodeBS msg) q
| otherwise -> do
liftIO $ clearProgressMeter s
liftIO $ flushed $ S.putStr msg
JSONOutput _ -> void $ jsonoutputter jsonbuilder s JSONOutput _ -> void $ jsonoutputter jsonbuilder s
QuietOutput -> q QuietOutput -> q
SerializedOutput h _ -> do SerializedOutput h _ -> do