Fix left clicks in terminals

This commit is contained in:
2023-05-03 16:45:39 +01:00
parent 1d5f982fcc
commit 727e5af2a6
7 changed files with 33 additions and 24 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ doTerminalEffectLB :: Terminal -> World -> World
doTerminalEffectLB tm w = fromMaybe w $ do
guard (_tmStatus tm == TerminalReady)
s <- w ^? cWorld . lWorld . terminals . ix (_tmID tm) . tmInput . tiText
if null (words s)
if null (words s) && null (_tmPartialCommand tm)
then Just $ defocusTerminalInput w
else return $ terminalReturnEffect tm w
+2 -2
View File
@@ -11,7 +11,7 @@ terminalReturnEffect :: Terminal -> World -> World
terminalReturnEffect tm w = fromMaybe w $ do
guard $ _tmStatus tm == TerminalReady
s <- w ^? cWorld . lWorld . terminals . ix (_tmID tm) . tmInput . tiText
let pc = maybe "" (++ " ") $ tm ^? tmPartialCommand . _Just
let pc = maybe "" (++ " ") $ tm ^? tmPartialCommand . _Just . tcString
return $
runTerminalString (pc ++ s) tm $
w
@@ -22,7 +22,7 @@ terminalReturnEffect tm w = fromMaybe w $ do
runTerminalString :: String -> Terminal -> World -> World
runTerminalString s tm w =
w & cWorld . lWorld . terminals . ix (_tmID tm)
%~ ( (tmInput .~ TerminalInput mempty True (0, 0))
%~ ( (tmInput .~ TerminalInput {_tiText = mempty, _tiFocus = True, _tiSel = (0, 0)})
. (tmFutureLines ++.~ commandFutureLines s tm w)
. (tmCommandHistory %~ take 10 . (s :))
)