Skip to content

Commit 5f46abb

Browse files
set title woohoo
1 parent a33a563 commit 5f46abb

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

potato_flow

src/Potato/Flow/Vty/Main.hs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -265,14 +265,12 @@ mainPFWidgetWithBypass MainPFWidgetConfig {..} bypassEvent = mdo
265265
mspf :: Maybe (SPotatoFlow, ControllerMeta) <- liftIO $ Aeson.decodeFileStrict absfp
266266
return (mspf, absfp)
267267

268-
269-
-- TODO finish hooking up the event
270-
-- TODO how to tell if dirty or not (with undos etc)
271268
-- set the title
272269
let
273-
setOpenFileStateEv = never
274-
performEvent_ $ ffor setOpenFileStateEv $ \(fn, dirty) -> do
275-
liftIO $ hSetTitle stdout $ fn <> (if dirty then "*" else "")
270+
setOpenFileStateEv = traceEvent "hi" $ updated $ ffor2 currentOpenFileDyn (_goatWidget_unsavedChanges everythingW) (,)
271+
performEvent_ $ ffor setOpenFileStateEv $ \(mfn, dirty) -> do
272+
-- this only seems to sometimes work 🤷🏼‍♀️
273+
liftIO $ hSetTitle stdout $ fromMaybe "<>" mfn <> (if dirty then "*" else "")
276274

277275

278276
let
@@ -309,7 +307,7 @@ mainPFWidgetWithBypass MainPFWidgetConfig {..} bypassEvent = mdo
309307
let
310308
potatoConfig = PotatoConfig {
311309
_potatoConfig_style = constant def
312-
, _potatoConfig_appCurrentOpenFile = current (traceDyn "set open file:" currentOpenFileDyn)
310+
, _potatoConfig_appCurrentOpenFile = current currentOpenFileDyn
313311
, _potatoConfig_appCurrentDirectory = fmap (maybe _mainPFWidgetConfig_homeDirectory FP.takeDirectory) $ current currentOpenFileDyn
314312
-- TODO
315313
, _potatoConfig_appPrintFile = constant Nothing

0 commit comments

Comments
 (0)