Mostly use String instead of Text

This commit is contained in:
2023-01-15 12:26:45 +00:00
parent 64b1c2761e
commit a50e2ff406
18 changed files with 50 additions and 65 deletions
+3 -4
View File
@@ -1,7 +1,6 @@
module Dodge.Terminal.LeftButton where
import Data.Maybe
import qualified Data.Text as T
import Dodge.Data.World
import Dodge.Terminal--oops
import LensHelp
@@ -9,7 +8,7 @@ import LensHelp
doTerminalEffectLB :: Terminal -> World -> World
doTerminalEffectLB tm w = guardDisconnected tm w $
fromMaybe w $ do
s <- fmap T.unpack $ w ^? cWorld . lWorld . terminals . ix (_tmID tm) . tmInput . tiText
s <- w ^? cWorld . lWorld . terminals . ix (_tmID tm) . tmInput . tiText
if null (words s)
then Just $ defocusTerminalInput w
else return $ terminalReturnEffect tm w
@@ -17,7 +16,7 @@ doTerminalEffectLB tm w = guardDisconnected tm w $
terminalReturnEffect :: Terminal -> World -> World
terminalReturnEffect tm w = guardDisconnected tm w $
fromMaybe w $ do
s <- fmap T.unpack $ w ^? cWorld . lWorld . terminals . ix (_tmID tm) . tmInput . tiText
s <- w ^? cWorld . lWorld . terminals . ix (_tmID tm) . tmInput . tiText
return $
runTerminalString s tm $
w
@@ -31,7 +30,7 @@ defocusTerminalInput w = fromMaybe w $ do
runTerminalString :: String -> Terminal -> World -> World
runTerminalString s tm w =
w & cWorld . lWorld . terminals . ix (_tmID tm)
%~ ( (tmInput .~ TerminalInput T.empty True (0, 0))
%~ ( (tmInput .~ TerminalInput mempty True (0, 0))
. (tmFutureLines ++.~ commandFutureLines s tm w)
. (tmCommandHistory %~ take 10 . (s :))
)