Fix terminal scrolling

This commit is contained in:
2025-12-30 19:28:05 +00:00
parent 4390a82d64
commit 26b4b77ff6
3 changed files with 70 additions and 36 deletions
+12 -11
View File
@@ -131,19 +131,20 @@ terminalWheelEvent yi tmid w
-- | w & has (input . mouseButtons . ix ButtonRight)
-- , Just TerminalTextInput{} <- w ^? cWorld . lWorld . terminals . ix tmid . tmStatus =
-- w & cWorld . lWorld . terminals . ix tmid %~ f
-- | Just TerminalTextInput{} <- w ^? cWorld . lWorld . terminals . ix tmid . tmStatus =
-- w & cWorld . lWorld . terminals . ix tmid %~ f
| Just TerminalTextInput{} <- w ^? cWorld . lWorld . terminals . ix tmid . tmStatus =
w & cWorld . lWorld . terminals . ix tmid %~ f
| otherwise = w
where
-- dowrap = if yi > 0 then wrapup else wrapdown
-- wrapup s coms = recComFindSuccessor (words s) coms <|> recComFindMin coms
-- wrapdown s coms = recComFindPredecessor (words s) coms <|> recComFindMax coms
-- f tm = fromMaybe tm $ do
-- let coms = getCommands w tm
-- x <- tm ^? tmStatus . tiText
-- let s = fromMaybe "" $ x ^? to words . ix 0
-- (s', _) <- dowrap s coms
-- return $ tm & tmStatus . tiText .~ unwords s'
dowrap = if yi > 0 then wrapup else wrapdown
wrapup s coms = recComFindSuccessor (words s) coms -- <|> recComFindMin coms
wrapdown s coms = recComFindPredecessor (words s) coms -- <|> recComFindMax coms
f tm = fromMaybe tm $ do
let coms = getCommands w tm
x <- tm ^? tmStatus . tiText
let s = fromMaybe "" $ x ^? to words . ix 0
--(s', _) <- dowrap s coms
(s', _) <- dowrap x coms
return $ tm & tmStatus . tiText .~ unwords s'
---- g tm = fromMaybe tm $ do
---- let coms = getCommands w tm
---- x <- tm ^? tmStatus . tiText