Cleanup
This commit is contained in:
+12
-16
@@ -100,10 +100,6 @@ handlePressedMouseButton but w = case (_hudElement (_hud w), but) of
|
||||
| otherwise -> w & terminals . ix tmid . tmInput . _Just . tiFocus %~ const True
|
||||
( DisplayInventory (CombineInventory mi) , ButtonLeft)
|
||||
-> maybe (hud . hudElement .~ DisplayInventory NoSubInventory) doCombine mi w
|
||||
-- -> fromMaybe (w & hud . hudElement .~ DisplayInventory NoSubInventory)
|
||||
-- $ do -- ugly
|
||||
-- i <- mi
|
||||
-- return $ doCombine i w
|
||||
_ -> w
|
||||
|
||||
-- note "sort" on the inventory indices; otherwise
|
||||
@@ -154,17 +150,17 @@ wheelEvent y w = case _hudElement $ _hud w of
|
||||
& terminals . ix tmid %~ updatetermsel
|
||||
_ -> w
|
||||
where
|
||||
updatetermsel tp = case _tmSel tp of
|
||||
Nothing -> tp & tmSel ?~ (0,0)
|
||||
& tmInput . _Just . tiText %~ replacewith tp 0
|
||||
Just (i,_) -> let newi = ((`mod` length (scrollCommands tp)) . subtract yi) i
|
||||
in tp & tmSel . _Just .~ (newi,0)
|
||||
& tmInput . _Just . tiText %~ replacewith tp newi
|
||||
updatetermsubsel tp = case _tmSel tp of
|
||||
Nothing -> tp
|
||||
Just (i,j) -> let newj = (j - yi) `mod` (1 + length (_tcArguments (scrollCommands tp !! i) tp w))
|
||||
in tp & tmSel . _Just .~ (i,newj)
|
||||
& tmInput . _Just . tiText %~ replacewith' tp i newj w
|
||||
updatetermsel tm = case tm ^? tmInput . _Just . tiSel of
|
||||
Nothing -> tm & tmInput . _Just . tiSel .~ (0,0)
|
||||
& tmInput . _Just . tiText %~ replacewith tm 0
|
||||
Just (i,_) -> let newi = ((`mod` length (scrollCommands tm)) . subtract yi) i
|
||||
in tm & tmInput . _Just . tiSel .~ (newi,0)
|
||||
& tmInput . _Just . tiText %~ replacewith tm newi
|
||||
updatetermsubsel tm = case tm ^? tmInput . _Just . tiSel of
|
||||
Nothing -> tm
|
||||
Just (i,j) -> let newj = (j - yi) `mod` (1 + length (_tcArguments (scrollCommands tm !! i) tm w))
|
||||
in tm & tmInput . _Just . tiSel .~ (i,newj)
|
||||
& tmInput . _Just . tiText %~ replacewith' tm i newj w
|
||||
replacewith tp newi _ = T.pack (_tcString (scrollCommands tp !! newi))
|
||||
replacewith' tp i j w' _ = T.pack $ _tcString tc ++ " " ++ arg-- ++ ((_tcArguments tp) w !! j)
|
||||
where
|
||||
@@ -187,7 +183,7 @@ nullCommand = TerminalCommand
|
||||
, _tcHelp = ""
|
||||
, _tcArgumentType = Nothing
|
||||
, _tcArguments = const (const [])
|
||||
, _tcEffect = const $ \_ w -> Right $ w
|
||||
, _tcEffect = const $ \_ w -> Right w
|
||||
}
|
||||
|
||||
scrollRBOption :: Float -> World -> World
|
||||
|
||||
Reference in New Issue
Block a user