Allow for scrolling in combine regex
This commit is contained in:
@@ -47,20 +47,19 @@ backspaceInputted u = case u ^. uvWorld . input . pressedKeys . at ScancodeBacks
|
||||
doSubInvRegexInput :: Universe -> Universe
|
||||
doSubInvRegexInput u
|
||||
| backspacetonothing
|
||||
= u & uvWorld . hud . hudElement . subInventory . subInvMap . smRegex %~ const NoSMRegex
|
||||
= u & uvWorld . hud . hudElement . subInventory . subInvMap . smRegex .~ Nothing
|
||||
& uvWorld . hud . hudElement . subInventory . subInvMap %~ initialSelPos
|
||||
& uvWorld . hud . hudElement . subInventory . subInvMap %~ setShownIntMap
|
||||
| endkeys || endmouse
|
||||
= u & uvWorld . hud . hudElement . subInventory . subInvMap . smRegex . smrInput %~ const False
|
||||
& uvWorld . hud . hudElement . subInventory . subInvMap %~ initialSelPos
|
||||
| otherwise = u & doTextInputOver (uvWorld . hud . hudElement . subInventory . subInvMap . smRegex. smrString)
|
||||
= u & uvWorld . hud . hudElement . subInventory . subInvMap %~ initialSelPos
|
||||
| otherwise = u & doTextInputOver (uvWorld . hud . hudElement . subInventory . subInvMap . smRegex . _Just)
|
||||
& uvWorld . hud . hudElement . subInventory . subInvMap %~ setShownIntMap
|
||||
where
|
||||
endkeys = any
|
||||
( (== Just InitialPress) . (`M.lookup` pkeys))
|
||||
[ScancodeReturn,ScancodeEscape,ScancodeSlash]
|
||||
endmouse = Just True == (u ^? uvWorld . input . mouseButtons . ix ButtonLeft)
|
||||
backspacetonothing = u ^? uvWorld . hud . hudElement . subInventory . subInvMap . smRegex . smrString == Just ""
|
||||
backspacetonothing = u ^? uvWorld . hud . hudElement . subInventory . subInvMap . smRegex . _Just == Just ""
|
||||
&& ScancodeBackspace `M.lookup` pkeys == Just InitialPress
|
||||
pkeys = u ^. uvWorld . input . pressedKeys
|
||||
|
||||
@@ -106,16 +105,18 @@ updateKeyInGame uv sc InitialPress = case sc of
|
||||
ScancodeSlash -> uv
|
||||
& uvWorld . hud . hudElement . subInventory . subInvMap . smRegex %~ enterregex
|
||||
& uvWorld . hud . hudElement . subInventory . subInvMap . smSelPos ?~ 0
|
||||
& uvWorld . hud . hudElement . subInventory . subInvMap %~ setShownIntMap
|
||||
ScancodeBackspace -> uv
|
||||
& uvWorld . hud . hudElement . subInventory . subInvMap . smRegex %~ enternonzeroregex
|
||||
& uvWorld . hud . hudElement . subInventory . subInvMap . smSelPos ?~ 0
|
||||
& uvWorld . hud . hudElement . subInventory . subInvMap %~ setShownIntMap
|
||||
|
||||
-- in fact the whole logic should probably be rethought, oh well
|
||||
_ -> uv
|
||||
where
|
||||
enterregex NoSMRegex = SMRegex "" True
|
||||
enterregex (SMRegex str _) = SMRegex str True
|
||||
enternonzeroregex (SMRegex (x:xs) _) = SMRegex (init (x:xs)) True
|
||||
enterregex Nothing = Just ""
|
||||
enterregex (Just str) = Just str
|
||||
enternonzeroregex (Just (x:xs)) = Just (init (x:xs))
|
||||
enternonzeroregex smr = smr
|
||||
updateKeyInGame uv sc LongPress = case sc of
|
||||
ScancodeF -> over uvWorld youDropItem uv
|
||||
|
||||
Reference in New Issue
Block a user