diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-11-05 20:18:27 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-11-05 20:18:27 -0400 |
commit | e6e42edb8bc8fc4bf051eda2e92fc6c5aefaa2f7 (patch) | |
tree | 67aaeabcaf3ea3f99ad0f60f60eacdb9cfeb633a | |
parent | 393d156deb01a71031c3a7ff6fe87d5e945b619e (diff) |
don't display console regions untill there is output in them
-rw-r--r-- | Messages/Concurrent.hs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Messages/Concurrent.hs b/Messages/Concurrent.hs index bb949af03..5b125a97f 100644 --- a/Messages/Concurrent.hs +++ b/Messages/Concurrent.hs @@ -43,7 +43,12 @@ concurrentMessage iserror msg _ = go =<< consoleRegion <$> Annex.getState Annex. when iserror $ do Annex.changeState $ \s -> s { Annex.output = (Annex.output s) { consoleRegionErrFlag = True } } - liftIO $ Regions.appendConsoleRegion r msg + liftIO $ atomically $ do + Regions.appendConsoleRegion r msg + rl <- takeTMVar Regions.regionList + putTMVar Regions.regionList + (if r `elem` rl then rl else r:rl) + #else concurrentMessage _ _ fallback = fallback #endif @@ -73,7 +78,10 @@ inOwnConsoleRegion a = do rmregion r return ret where - mkregion = Regions.openConsoleRegion Regions.Linear + -- The region is allocated here, but not displayed until + -- a message is added to it. This avoids unnecessary screen + -- updates when a region does not turn out to need to be used. + mkregion = Regions.newConsoleRegion Regions.Linear "" setregion r = Annex.changeState $ \s -> s { Annex.output = (Annex.output s) { consoleRegion = r } } rmregion r = do errflag <- consoleRegionErrFlag <$> Annex.getState Annex.output |