Tweak cursor storage on sss

This commit is contained in:
2023-02-19 09:53:09 +00:00
parent 41851ba24d
commit 8ec1dc0830
10 changed files with 163 additions and 151 deletions
+6 -5
View File
@@ -6,6 +6,7 @@ module Dodge.Update.Input (
doRegexInput,
) where
import Dodge.SelectionSections
import Dodge.Default.World
import Data.Char
import qualified Data.IntMap.Strict as IM
@@ -18,7 +19,7 @@ import Dodge.Combine
import Dodge.Creature.Action
import Dodge.Data.Universe
import Dodge.Debug.Terminal
import Dodge.DisplayInventory
--import Dodge.DisplayInventory
import Dodge.Event.Test
import Dodge.Inventory
import Dodge.Menu
@@ -28,7 +29,7 @@ import Dodge.Terminal.LeftButton
import Dodge.WorldPos
import LensHelp
import SDL
import SelectionIntMap
--import SelectionIntMap
doTextInputOver :: ASetter' Universe String -> Universe -> Universe
doTextInputOver p u =
@@ -184,7 +185,7 @@ updateBackspaceRegex w = case di ^? subInventory of
_ -> w
where
secfocus a b = fromMaybe False $ do
i <- di ^? diSections . sssSelPos . _Just
i <- di ^? diSections . sssSelPos . _Just . _1
return $ i == a || i == b
trybackspace cm = case cm ^? invRegex . _Just of
Just (_ : _) ->
@@ -226,14 +227,14 @@ updateEnterRegex w = case w ^? hud . hudElement . subInventory of
where
di = w ^. hud . hudElement
secfocus a b = fromMaybe False $ do
i <- di ^? diSections . sssSelPos . _Just
i <- di ^? diSections . sssSelPos . _Just . _1
return $ i == a || i == b
enterregex Nothing = Just ""
enterregex x = x
overSection :: (SelectionSection a -> SelectionSection a) -> SelectionSections a -> SelectionSections a
overSection f sss = fromMaybe sss $ do
i <- sss ^? sssSelPos . _Just
i <- sss ^? sssSelPos . _Just . _1
return $ sss & sssSections . ix i %~ f
pauseGame :: Universe -> Universe