From 458cf138d6a9d6f1281b093913436934bdceeb5f Mon Sep 17 00:00:00 2001 From: Yvee1 Date: Sat, 23 Dec 2023 17:56:42 +0100 Subject: [PATCH] Use Shift+Tab for showing answer Also change capitalization of keys in info text. --- src/UI/Cards.hs | 20 ++++++++++---------- src/UI/Info.hs | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/UI/Cards.hs b/src/UI/Cards.hs index 89eae65..b625231 100644 --- a/src/UI/Cards.hs +++ b/src/UI/Cards.hs @@ -41,12 +41,12 @@ drawUI s = [maybe emptyWidget (`drawPopup` s) (s^.popup), drawCardUI s <=> draw drawInfo :: CS -> Widget Name drawInfo s = if not (s ^. showControls) then emptyWidget else - strWrap . ("ESC: quit" <>) $ case s ^. cardState of - DefinitionState {} -> ", ENTER: flip card / continue" - MultipleChoiceState {} -> ", ENTER: submit answer / continue" - MultipleAnswerState {} -> ", ENTER: select / continue, c: submit selection" - OpenQuestionState {} -> ", LEFT/RIGHT/TAB: navigate gaps, ENTER: submit answer / continue, Ctrl+F1: show answer" - ReorderState {} -> ", ENTER: grab, c: submit answer" + strWrap . ("Esc: quit" <>) $ case s ^. cardState of + DefinitionState {} -> ", Enter: flip card / continue" + MultipleChoiceState {} -> ", Enter: submit answer / continue" + MultipleAnswerState {} -> ", Enter: select / continue, c: submit selection" + OpenQuestionState {} -> ", Left/Right/Tab: navigate gaps, Enter: submit answer / continue, Shift+Tab: show answer" + ReorderState {} -> ", Enter: grab, c: submit answer" drawCardBox :: Widget Name -> Widget Name drawCardBox w = C.center $ @@ -360,7 +360,7 @@ handleEvent (VtyEvent e) = (OpenQuestionState {_highlighted = i, _number = n, _gapInput = kvs, _correctGaps = cGaps, _failed=fail}, OpenQuestion _ _ perforated) -> case ev of - V.EvKey (V.KFun 1) [V.MCtrl] -> zoom (cs.cardState) $ do + V.EvKey (V.KChar '\t') [V.MShift] -> zoom (cs.cardState) $ do gapInput .= correctAnswers entered .= True failed .= True @@ -391,7 +391,7 @@ handleEvent (VtyEvent e) = V.EvKey (V.KChar c) [] -> zoom (cs.cardState) $ do unless frozen $ gapInput.at i.non "" %= (++[c]) - case c of + when frozen $ case c of 'k' -> up 'j' -> down _ -> return () @@ -425,8 +425,8 @@ handleEvent (VtyEvent e) = _ -> return () where frozen = M.foldr (&&) True cGaps - down = when frozen $ scroll s 1 - up = when frozen $ scroll s (-1) + down = scroll s 1 + up = scroll s (-1) (ReorderState {_highlighted = i, _entered = submitted, _grabbed=dragging, _number = n, _order = kvs }, Reorder _ _ elts) -> case ev of diff --git a/src/UI/Info.hs b/src/UI/Info.hs index b8d414f..c9cee68 100644 --- a/src/UI/Info.hs +++ b/src/UI/Info.hs @@ -63,10 +63,10 @@ info = unlines , "" , " * Enter confirms a selection, flips a card or continues to the next card" , "" - , " * Use TAB or the arrow keys for navigating gaps in open questions" + , " * Use Tab or the arrow keys for navigating gaps in open questions" , "" , " * Use the c key for confirming reorder questions or multiple choice questions with more than 1 possible answer" , "" - , " * Use Ctrl+F1 to show the answers of a open question" + , " * Use Shift+Tab to show the answers of a open question" , "" , " * Use Ctrl+Left and Ctrl+Right to move to previous and next cards without having to answer them; this is disabled in review mode"]