ui: enable mouse support at startup
This commit is contained in:
parent
8f37d8a611
commit
2076d5a98b
@ -17,7 +17,7 @@ import Data.List (find)
|
|||||||
import Data.List.Extra (nubSort)
|
import Data.List.Extra (nubSort)
|
||||||
import Data.Maybe (fromMaybe)
|
import Data.Maybe (fromMaybe)
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import Graphics.Vty (mkVty)
|
import Graphics.Vty (mkVty, Mode (Mouse), Vty (outputIface), Output (setMode))
|
||||||
import Lens.Micro ((^.))
|
import Lens.Micro ((^.))
|
||||||
import System.Directory (canonicalizePath)
|
import System.Directory (canonicalizePath)
|
||||||
import System.FilePath (takeDirectory)
|
import System.FilePath (takeDirectory)
|
||||||
@ -168,9 +168,17 @@ runBrickUi uopts@UIOpts{uoCliOpts=copts@CliOpts{inputopts_=_iopts,reportspec_=rs
|
|||||||
|
|
||||||
-- print (length (show ui)) >> exitSuccess -- show any debug output to this point & quit
|
-- print (length (show ui)) >> exitSuccess -- show any debug output to this point & quit
|
||||||
|
|
||||||
|
let
|
||||||
|
-- helper: make a Vty terminal controller with mouse support enabled
|
||||||
|
makevty = do
|
||||||
|
v <- mkVty mempty
|
||||||
|
setMode (outputIface v) Mouse True
|
||||||
|
return v
|
||||||
|
|
||||||
if not (uoWatch uopts')
|
if not (uoWatch uopts')
|
||||||
then
|
then do
|
||||||
void $ Brick.defaultMain brickapp ui
|
vty <- makevty
|
||||||
|
void $ customMain vty makevty Nothing brickapp ui
|
||||||
|
|
||||||
else do
|
else do
|
||||||
-- a channel for sending misc. events to the app
|
-- a channel for sending misc. events to the app
|
||||||
@ -228,7 +236,6 @@ runBrickUi uopts@UIOpts{uoCliOpts=copts@CliOpts{inputopts_=_iopts,reportspec_=rs
|
|||||||
writeChan eventChan FileChange
|
writeChan eventChan FileChange
|
||||||
)
|
)
|
||||||
|
|
||||||
-- and start the app. Must be inside the withManager block
|
-- and start the app. Must be inside the withManager block. (XXX makevty too ?)
|
||||||
let vtyhandle = mkVty mempty
|
vty <- makevty
|
||||||
vty <- vtyhandle
|
void $ customMain vty makevty (Just eventChan) brickapp ui
|
||||||
void $ customMain vty vtyhandle (Just eventChan) brickapp ui
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user