patat 0.4.5.0 → 0.4.6.0
raw patch · 5 files changed
+26/−14 lines, 5 files
Files
- CHANGELOG.md +6/−0
- patat.cabal +1/−1
- src/Main.hs +4/−1
- src/Patat/Presentation/Display.hs +4/−3
- src/Patat/Presentation/Interactive.hs +11/−9
CHANGELOG.md view
@@ -1,5 +1,11 @@ # Changelog +- 0.4.6.0 (2016-12-28)+ * Redraw the screen on unknown commands to prevent accidental typing from+ showing up.+ * Make the cursor invisible during the presentation.+ * Move the footer down one more line to gain some screen real estate.+ - 0.4.5.0 (2016-12-05) * Render the date in a locale-independent manner (patch by Daniel Shahaf).
patat.cabal view
@@ -1,5 +1,5 @@ Name: patat-Version: 0.4.5.0+Version: 0.4.6.0 Synopsis: Terminal-based presentations using Pandoc Description: Terminal-based presentations using Pandoc License: GPL-2
src/Main.hs view
@@ -9,6 +9,7 @@ import Control.Applicative ((<$>), (<*>)) import Control.Concurrent (forkIO, threadDelay) import qualified Control.Concurrent.Chan as Chan+import Control.Exception (finally) import Control.Monad (forever, unless, when) import qualified Data.Aeson.Extended as A import Data.Monoid (mempty, (<>))@@ -131,8 +132,10 @@ else interactiveLoop options pres where interactiveLoop :: Options -> Presentation -> IO ()- interactiveLoop options pres0 = do+ interactiveLoop options pres0 = (`finally` Ansi.showCursor) $ do IO.hSetBuffering IO.stdin IO.NoBuffering+ Ansi.hideCursor+ -- Spawn the initial channel that gives us commands based on user input. commandChan0 <- Chan.newChan _ <- forkIO $ forever $
src/Patat/Presentation/Display.hs view
@@ -26,10 +26,11 @@ import qualified Patat.PrettyPrint as PP import Patat.Theme (Theme (..)) import qualified Patat.Theme as Theme+import Prelude import qualified System.Console.ANSI as Ansi import qualified System.Console.Terminal.Size as Terminal+import qualified System.IO as IO import qualified Text.Pandoc.Extended as Pandoc-import Prelude --------------------------------------------------------------------------------@@ -69,11 +70,11 @@ active = show (sidx + 1) ++ " / " ++ show (length pSlides) activeWidth = length active - Ansi.setCursorPosition (rows - 2) 0+ Ansi.setCursorPosition (rows - 1) 0 PP.putDoc $ " " <> borders (prettyInlines theme pAuthor) Ansi.setCursorColumn (columns - activeWidth - 1) PP.putDoc $ borders $ PP.string active- putStrLn ""+ IO.hFlush IO.stdout --------------------------------------------------------------------------------
src/Patat/Presentation/Interactive.hs view
@@ -27,6 +27,7 @@ | First | Last | Reload+ | UnknownCommand String --------------------------------------------------------------------------------@@ -48,7 +49,7 @@ "0" -> return First "G" -> return Last "r" -> return Reload- _ -> readPresentationCommand+ _ -> return (UnknownCommand k) where readKey :: IO String readKey = do@@ -77,14 +78,15 @@ :: PresentationCommand -> Presentation -> IO UpdatedPresentation updatePresentation cmd presentation = case cmd of- Exit -> return ExitedPresentation- Forward -> return $ goToSlide $ \(s, f) -> (s, f + 1)- Backward -> return $ goToSlide $ \(s, f) -> (s, f - 1)- SkipForward -> return $ goToSlide $ \(s, _) -> (s + 10, 0)- SkipBackward -> return $ goToSlide $ \(s, _) -> (s - 10, 0)- First -> return $ goToSlide $ \_ -> (0, 0)- Last -> return $ goToSlide $ \_ -> (numSlides presentation, 0)- Reload -> reloadPresentation+ Exit -> return ExitedPresentation+ Forward -> return $ goToSlide $ \(s, f) -> (s, f + 1)+ Backward -> return $ goToSlide $ \(s, f) -> (s, f - 1)+ SkipForward -> return $ goToSlide $ \(s, _) -> (s + 10, 0)+ SkipBackward -> return $ goToSlide $ \(s, _) -> (s - 10, 0)+ First -> return $ goToSlide $ \_ -> (0, 0)+ Last -> return $ goToSlide $ \_ -> (numSlides presentation, 0)+ Reload -> reloadPresentation+ UnknownCommand _ -> return (UpdatedPresentation presentation) where numSlides :: Presentation -> Int numSlides pres = length (pSlides pres)