mirror of
https://github.com/Yvee1/hascard.git
synced 2024-11-26 07:30:14 +03:00
commit
efc5a24bd2
@ -73,6 +73,7 @@ handleEvent gs s@CSS{_list=l, _exception=exc} (VtyEvent ev) =
|
|||||||
(Just _, _) -> continue' $ s & exception .~ Nothing
|
(Just _, _) -> continue' $ s & exception .~ Nothing
|
||||||
(_, e) -> case e of
|
(_, e) -> case e of
|
||||||
V.EvKey V.KEsc [] -> halt' gs
|
V.EvKey V.KEsc [] -> halt' gs
|
||||||
|
V.EvKey (V.KChar 'q') [] -> halt' gs
|
||||||
|
|
||||||
_ -> do l' <- L.handleListEventVi L.handleListEvent e l
|
_ -> do l' <- L.handleListEventVi L.handleListEvent e l
|
||||||
let s' = (s & list .~ l') in
|
let s' = (s & list .~ l') in
|
||||||
|
@ -33,7 +33,7 @@ drawUI s = [maybe emptyWidget (`drawPopup` s) (s^.popup), drawCardUI s <=> draw
|
|||||||
|
|
||||||
drawInfo :: CS -> Widget Name
|
drawInfo :: CS -> Widget Name
|
||||||
drawInfo s = if not (s ^. showControls) then emptyWidget else
|
drawInfo s = if not (s ^. showControls) then emptyWidget else
|
||||||
strWrap . ("ESC: quit" <>) $ case s ^. cardState of
|
strWrap . ("ESC or q: quit" <>) $ case s ^. cardState of
|
||||||
DefinitionState {} -> ", ENTER: flip card / continue"
|
DefinitionState {} -> ", ENTER: flip card / continue"
|
||||||
MultipleChoiceState {} -> ", ENTER: submit answer / continue"
|
MultipleChoiceState {} -> ", ENTER: submit answer / continue"
|
||||||
MultipleAnswerState {} -> ", ENTER: select / continue, c: submit selection"
|
MultipleAnswerState {} -> ", ENTER: select / continue, c: submit selection"
|
||||||
|
@ -46,7 +46,7 @@ drawUI FBS{_fb=b, _exception'=exc} = [drawException exc, center $ ui <=> help]
|
|||||||
vBox [ hCenter $ txt "Up/Down: select, h: toggle show hidden files"
|
vBox [ hCenter $ txt "Up/Down: select, h: toggle show hidden files"
|
||||||
, hCenter $ txt "/: search, Ctrl-C or Esc: cancel search"
|
, hCenter $ txt "/: search, Ctrl-C or Esc: cancel search"
|
||||||
, hCenter $ txt "Enter: change directory or select file"
|
, hCenter $ txt "Enter: change directory or select file"
|
||||||
, hCenter $ txt "Esc: quit"
|
, hCenter $ txt "Esc or q: quit"
|
||||||
]
|
]
|
||||||
|
|
||||||
handleEvent :: GlobalState -> FBS -> BrickEvent Name Event -> EventM Name (Next GlobalState)
|
handleEvent :: GlobalState -> FBS -> BrickEvent Name Event -> EventM Name (Next GlobalState)
|
||||||
|
@ -29,6 +29,7 @@ handleEvent gs s (VtyEvent e) =
|
|||||||
halt' = continue . popState in
|
halt' = continue . popState in
|
||||||
case e of
|
case e of
|
||||||
V.EvKey V.KEsc [] -> halt' gs
|
V.EvKey V.KEsc [] -> halt' gs
|
||||||
|
V.EvKey (V.KChar 'q') [] -> halt' gs
|
||||||
V.EvKey V.KEnter [] -> halt' gs
|
V.EvKey V.KEnter [] -> halt' gs
|
||||||
V.EvKey V.KDown [] -> vScrollBy (viewportScroll Ordinary) 1 >> continue' s
|
V.EvKey V.KDown [] -> vScrollBy (viewportScroll Ordinary) 1 >> continue' s
|
||||||
V.EvKey (V.KChar 'j') [] -> vScrollBy (viewportScroll Ordinary) 1 >> continue' s
|
V.EvKey (V.KChar 'j') [] -> vScrollBy (viewportScroll Ordinary) 1 >> continue' s
|
||||||
|
@ -49,6 +49,7 @@ handleEvent gs s (VtyEvent e) =
|
|||||||
let update = updateMMS gs in
|
let update = updateMMS gs in
|
||||||
case e of
|
case e of
|
||||||
V.EvKey V.KEsc [] -> halt gs
|
V.EvKey V.KEsc [] -> halt gs
|
||||||
|
V.EvKey (V.KChar 'q') [] -> halt gs
|
||||||
V.EvKey V.KEnter [] ->
|
V.EvKey V.KEnter [] ->
|
||||||
case L.listSelected (s^.l) of
|
case L.listSelected (s^.l) of
|
||||||
Just 0 -> continue =<< (gs `goToState`) <$> liftIO cardSelectorState
|
Just 0 -> continue =<< (gs `goToState`) <$> liftIO cardSelectorState
|
||||||
|
@ -50,6 +50,7 @@ handleEvent gs s ev@(VtyEvent e) =
|
|||||||
in case e of
|
in case e of
|
||||||
-- continue gs
|
-- continue gs
|
||||||
V.EvKey V.KEsc [] -> halt' gs
|
V.EvKey V.KEsc [] -> halt' gs
|
||||||
|
V.EvKey (V.KChar 'q') [] -> halt' gs
|
||||||
V.EvKey V.KDown [] -> down
|
V.EvKey V.KDown [] -> down
|
||||||
V.EvKey (V.KChar 'j') [] -> down
|
V.EvKey (V.KChar 'j') [] -> down
|
||||||
V.EvKey V.KUp [] -> up
|
V.EvKey V.KUp [] -> up
|
||||||
|
@ -45,6 +45,7 @@ handleEvent gs form ev@(VtyEvent e) =
|
|||||||
in
|
in
|
||||||
case e of
|
case e of
|
||||||
V.EvKey V.KEsc [] -> halt' gs
|
V.EvKey V.KEsc [] -> halt' gs
|
||||||
|
V.EvKey (V.KChar 'q') [] -> halt' gs
|
||||||
V.EvKey V.KDown [] -> down
|
V.EvKey V.KDown [] -> down
|
||||||
V.EvKey (V.KChar 'j') [] -> down
|
V.EvKey (V.KChar 'j') [] -> down
|
||||||
V.EvKey V.KUp [] -> up
|
V.EvKey V.KUp [] -> up
|
||||||
|
Loading…
Reference in New Issue
Block a user