Commit before changing TerminalCommand to produce [TerminalLine]

This commit is contained in:
2022-06-06 20:25:38 +01:00
parent b20502bc35
commit 1fe41889fe
8 changed files with 32 additions and 28 deletions
+9 -9
View File
@@ -97,7 +97,7 @@ handlePressedMouseButton but w = case (_hudElement (_hud w), but) of
(_,ButtonMiddle) -> w & clickMousePos .~ _mousePos w
( DisplayInventory (DisplayTerminal tmid) , ButtonLeft)
| hasTerminalFocus w -> doTerminalEffectLB (w ^?! terminals . ix tmid) w
| otherwise -> w & terminals . ix tmid . tmInput . _Just . tiFocus %~ const True
| otherwise -> w & terminals . ix tmid . tmInput . tiFocus %~ const True
( DisplayInventory (CombineInventory mi) , ButtonLeft)
-> maybe (hud . hudElement .~ DisplayInventory NoSubInventory) doCombine mi w
_ -> w
@@ -150,17 +150,17 @@ wheelEvent y w = case _hudElement $ _hud w of
& terminals . ix tmid %~ updatetermsel
_ -> w
where
updatetermsel tm = case tm ^? tmInput . _Just . tiSel of
Nothing -> tm & tmInput . _Just . tiSel .~ (0,0)
& tmInput . _Just . tiText %~ replacewith tm 0
updatetermsel tm = case tm ^? tmInput . tiSel of
Nothing -> tm & tmInput . tiSel .~ (0,0)
& tmInput . 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
in tm & tmInput . tiSel .~ (newi,0)
& tmInput . tiText %~ replacewith tm newi
updatetermsubsel tm = case tm ^? tmInput . 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
in tm & tmInput . tiSel .~ (i,newj)
& tmInput . 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