summaryrefslogtreecommitdiffhomepage
path: root/Replay.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2017-05-04 15:16:04 -0400
committerJoey Hess <joeyh@joeyh.name>2017-05-04 15:16:04 -0400
commit18e70a49274033d0598fcdfe830f80b0cc3552f0 (patch)
tree435dede3375593cb84453197136c480f2102e749 /Replay.hs
parent62b488cb62a52eac92e6d37932a773ec138a5a2b (diff)
downloaddebug-me-18e70a49274033d0598fcdfe830f80b0cc3552f0.tar.gz
--replay: make Space advance to next output
This commit was sponsored by John Peloquin on Patreon.
Diffstat (limited to 'Replay.hs')
-rw-r--r--Replay.hs16
1 files changed, 14 insertions, 2 deletions
diff --git a/Replay.hs b/Replay.hs
index 37df9e1..fcbfc25 100644
--- a/Replay.hs
+++ b/Replay.hs
@@ -8,19 +8,24 @@ module Replay where
import Types
import Log
import CmdLine
+import Pty
import qualified Data.ByteString as B
import System.IO
+import Control.Concurrent.Async
import Control.Concurrent.Thread.Delay
replay :: ReplayOpts -> IO ()
-replay opts = go =<< streamLog (replayLogFile opts)
+replay opts = do
+ hSetBuffering stdin NoBuffering
+ withoutEcho $ go =<< streamLog (replayLogFile opts)
where
go [] = return ()
go (Right l:ls) = do
case loggedMessage l of
User (ActivityMessage a) -> do
- realisticDelay (elapsedTime a)
+ _ <- realisticDelay (elapsedTime a)
+ `race` waitSpaceBar
B.hPut stdout $ val $ seenData $ activity a
hFlush stdout
User (ControlMessage _) -> return ()
@@ -32,3 +37,10 @@ realisticDelay :: ElapsedTime -> IO ()
realisticDelay (ElapsedTime n)
| n < 1 = return ()
| otherwise = delay $ ceiling $ n * 1000000
+
+waitSpaceBar :: IO ()
+waitSpaceBar = do
+ c <- getChar
+ if c == ' '
+ then return ()
+ else waitSpaceBar