Fix left clicks in terminals
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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 :))
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user