From 8441e38d52f2162ad08a8113d7bfa4496b56c749 Mon Sep 17 00:00:00 2001 From: Junji Hashimoto Date: Mon, 28 May 2018 14:15:55 +0900 Subject: [PATCH] Add suspend for vty --- yi-frontend-vty/src/Yi/Frontend/Vty.hs | 5 +++++ yi-frontend-vty/yi-frontend-vty.cabal | 1 + 2 files changed, 6 insertions(+) diff --git a/yi-frontend-vty/src/Yi/Frontend/Vty.hs b/yi-frontend-vty/src/Yi/Frontend/Vty.hs index 5c1593a34..0f689621c 100644 --- a/yi-frontend-vty/src/Yi/Frontend/Vty.hs +++ b/yi-frontend-vty/src/Yi/Frontend/Vty.hs @@ -63,6 +63,7 @@ import qualified Graphics.Vty as Vty (Attr, Cursor (Cursor, No withForeColor, withStyle, (<|>)) import System.Exit (ExitCode, exitWith) +import System.Posix.Signals (raiseSignal, sigSTOP) import Yi.Buffer import Yi.Config import Yi.Debug (logError, logPutStrLn) @@ -167,6 +168,7 @@ start config submitEvents submitActions editor = do return $! Common.dummyUI { Common.main = main fs + , Common.suspend = suspend , Common.end = end fs , Common.refresh = requestRefresh fs , Common.userForceRefresh = Vty.refresh vty @@ -180,6 +182,9 @@ main fs = do exitCode <- takeMVar (fsEndMain fs) exitWith exitCode +suspend :: IO () +suspend = raiseSignal sigSTOP + layout :: FrontendState -> Editor -> IO Editor layout fs e = do (colCount, rowCount) <- Vty.displayBounds (Vty.outputIface (fsVty fs)) diff --git a/yi-frontend-vty/yi-frontend-vty.cabal b/yi-frontend-vty/yi-frontend-vty.cabal index 0e5a92751..3d447ee83 100644 --- a/yi-frontend-vty/yi-frontend-vty.cabal +++ b/yi-frontend-vty/yi-frontend-vty.cabal @@ -27,6 +27,7 @@ library , stm >= 2.2 , text , vty >= 5.4 + , unix , yi-core >= 0.17 , yi-language >= 0.17 , yi-rope >= 0.10