Continue mouse context refactor

This commit is contained in:
2024-11-18 22:21:12 +00:00
parent 69fe28afe7
commit 5b709cd7ba
7 changed files with 186 additions and 165 deletions
+6 -5
View File
@@ -273,16 +273,17 @@ commandFutureLines s tm w = fromMaybe [errline "^ Invalid command"] $ do
where
errline = makeColorTermLine red
terminalReturnEffect :: Terminal -> World -> World
terminalReturnEffect tm w = fromMaybe w $ do
terminalReturnEffect :: Int -> World -> World
terminalReturnEffect tmid w = fromMaybe w $ do
tm <- w ^? cWorld . lWorld . terminals. ix tmid
guard $ _tmStatus tm == TerminalReady
s <- w ^? cWorld . lWorld . terminals . ix (_tmID tm) . tmInput . tiText
s <- tm ^? tmInput . tiText
let pc = maybe "" (++ " ") $ tm ^? tmPartialCommand . _Just . tcString
return $
runTerminalString (pc ++ s) tm $
w
& cWorld . lWorld . terminals . ix (_tmID tm) . tmPartialCommand .~ Nothing
& cWorld . lWorld . terminals . ix (_tmID tm) . tmFutureLines
& cWorld . lWorld . terminals . ix tmid . tmPartialCommand .~ Nothing
& cWorld . lWorld . terminals . ix tmid . tmFutureLines
.~ [makeTermLine (pc ++ getPromptTM (tm ^. tmType) ++ s)]
runTerminalString :: String -> Terminal -> World -> World