Work on tab completion
This commit is contained in:
@@ -149,6 +149,24 @@ tabComplete' s' w tm = case PTE.lookup s $ getCommands w tm of
|
|||||||
<> [TLine 1 [] . TmTmSetStatus $ TerminalTextInput s']
|
<> [TLine 1 [] . TmTmSetStatus $ TerminalTextInput s']
|
||||||
)
|
)
|
||||||
|
|
||||||
|
tComplete
|
||||||
|
:: String
|
||||||
|
-> PTE.TrieMap Char (PTE.TrieMap Char [TerminalLine])
|
||||||
|
-> Either (String,[String]) (String,[String])
|
||||||
|
tComplete s pt = fromMaybe (Left (mempty,allcommands pt)) $ do
|
||||||
|
s1 <- words s ^? ix 0
|
||||||
|
let (e1,mx,pt') = PTE.splitPrefix $ PTE.deletePrefix s1 pt
|
||||||
|
case e1 of
|
||||||
|
[] -> do
|
||||||
|
pt'' <- mx
|
||||||
|
return $ fromMaybe (Right (mempty, allcommands pt'')) $ do
|
||||||
|
s2 <- words s ^? ix 1
|
||||||
|
let (e2,_,pt3) = PTE.splitPrefix $ PTE.deletePrefix s2 pt''
|
||||||
|
Just $ Right (e2, allcommands pt3)
|
||||||
|
_ -> Just $ Left (e1, allcommands pt')
|
||||||
|
where
|
||||||
|
allcommands = fmap fst . PTE.toList
|
||||||
|
|
||||||
-- damageCodeCommand :: TerminalCommand
|
-- damageCodeCommand :: TerminalCommand
|
||||||
-- damageCodeCommand =
|
-- damageCodeCommand =
|
||||||
-- TerminalCommand
|
-- TerminalCommand
|
||||||
|
|||||||
@@ -132,9 +132,9 @@ terminalWheelEvent :: Int -> Int -> World -> World
|
|||||||
terminalWheelEvent yi tmid w
|
terminalWheelEvent yi tmid w
|
||||||
| w & has (input . mouseButtons . ix ButtonRight)
|
| w & has (input . mouseButtons . ix ButtonRight)
|
||||||
, Just TerminalTextInput{} <- w ^? cWorld . lWorld . terminals . ix tmid . tmStatus =
|
, Just TerminalTextInput{} <- w ^? cWorld . lWorld . terminals . ix tmid . tmStatus =
|
||||||
w & cWorld . lWorld . terminals . ix tmid %~ g
|
|
||||||
| Just TerminalTextInput{} <- w ^? cWorld . lWorld . terminals . ix tmid . tmStatus =
|
|
||||||
w & cWorld . lWorld . terminals . ix tmid %~ f
|
w & cWorld . lWorld . terminals . ix tmid %~ f
|
||||||
|
| Just TerminalTextInput{} <- w ^? cWorld . lWorld . terminals . ix tmid . tmStatus =
|
||||||
|
w & cWorld . lWorld . terminals . ix tmid %~ g
|
||||||
| otherwise = w
|
| otherwise = w
|
||||||
where
|
where
|
||||||
dowrap = if yi > 0 then wrapup else wrapdown
|
dowrap = if yi > 0 then wrapup else wrapdown
|
||||||
|
|||||||
Reference in New Issue
Block a user