This commit is contained in:
2022-06-02 09:29:44 +01:00
parent b6e2b6ef21
commit 98cb8f2264
8 changed files with 57 additions and 48 deletions
+7 -7
View File
@@ -150,7 +150,7 @@ wheelEvent y w = case _hudElement $ _hud w of
| otherwise -> w & moveTweakSel yi
DisplayInventory (CombineInventory _) -> w
& hud . hudElement . subInventory . combineInvSel . _Just %~ ((`mod` numcombs) . subtract yi)
DisplayInventory (DisplayTerminal tp _)
DisplayInventory DisplayTerminal{}
| rbDown -> w
& hud . hudElement . subInventory . termParams %~ updatetermsubsel
| otherwise -> w
@@ -160,20 +160,20 @@ wheelEvent y w = case _hudElement $ _hud w of
updatetermsel tp = case _termSel tp of
Nothing -> tp & termSel ?~ (0,0)
& termInput . _Just %~ replacewith tp 0
Just (i,_) -> let newi = ((`mod` length (_termCommands tp)) . subtract yi) i
Just (i,_) -> let newi = ((`mod` length (_termScrollCommands tp)) . subtract yi) i
in tp & termSel . _Just .~ (newi,0)
& termInput . _Just %~ replacewith tp newi
updatetermsubsel tp = case _termSel tp of
Nothing -> tp
Just (i,j) -> let newj = (j - yi) `mod` (1 + length (_tcArguments (_termCommands tp !! i) w))
Just (i,j) -> let newj = (j - yi) `mod` (1 + length (_tcArguments (_termScrollCommands tp !! i) w))
in tp & termSel . _Just .~ (i,newj)
& termInput . _Just %~ replacewith' tp i newj w
replacewith tp newi _ = T.pack (_tcString (_termCommands tp !! newi))
replacewith' tp i j w _ = T.pack $ _tcString tc ++ " " ++ arg-- ++ ((_tcArguments tp) w !! j)
replacewith tp newi _ = T.pack (_tcString (_termScrollCommands tp !! newi))
replacewith' tp i j w' _ = T.pack $ _tcString tc ++ " " ++ arg-- ++ ((_tcArguments tp) w !! j)
where
arg :: String
arg = (("":(_tcArguments tc w) )!! j)
tc = _termCommands tp !! i
arg = ("": _tcArguments tc w' )!! j
tc = _termScrollCommands tp !! i
numcombs = length $ combineItemListYou w
yi = round $ signum y
numLocs = (fst . IM.findMax $ _seenLocations w) + 1