@@ -37,7 +37,7 @@ import Base hiding (all)
3737
3838import Core
3939import Config (package )
40- import State (getsST , touchST , HState (helpVisible , playHist ))
40+ import State (getsST , touchST , HState (helpVisible , histVisible ))
4141import Style (defaultSty , StringA (Fast ))
4242import qualified UI (resetui )
4343import Lexers ((>||<) ,action ,meta ,execLexer
@@ -47,7 +47,6 @@ import UI.HSCurses.Curses (Key(..), decodeKey)
4747
4848import qualified Data.ByteString.Char8 as P
4949import qualified Data.Map as M
50- import qualified Data.Sequence as Seq
5150
5251data Direction = Forwards | Backwards
5352data Zipper = Zipper { cur :: ! String , back :: ! [String ], front :: ! [String ] }
@@ -120,9 +119,9 @@ printSearch spec = with do
120119 touchST
121120
122121updateSearch :: (Zipper -> Zipper ) -> SearchState -> MetaTarget
123- updateSearch f st @ (SearchState _ spec) =
122+ updateSearch f sst @ (SearchState _ spec) =
124123 let spec' = spec{ schZipper = f $ schZipper spec }
125- in (printSearch spec', st {schSpec= spec'}, Just dosearch)
124+ in (printSearch spec', sst {schSpec= spec'}, Just dosearch)
126125
127126search_char :: LexerS
128127search_char = anyNonSpecial `meta` \ c -> updateSearch $ zipEdit (++ c)
@@ -168,30 +167,32 @@ search_eval = enter `meta` \_ (SearchState hist spec) -> case cur $ schZipper sp
168167
169168history :: LexerS
170169history = alt [' H' , ' ;' ] `meta`
171- \ _ st -> (with (showHist *> touchST), st , Just inner) where
170+ \ _ sst -> (with (showHist *> touchST), sst , Just inner) where
172171 inner =
173- alt any' `meta` (\ _ st -> (with (hideHist *> touchST), st , Just allKeys))
172+ alt any' `meta` (\ _ sst -> (with (hideHist *> touchST), sst , Just allKeys))
174173 >||< alt [' 0' .. ' 9' ] `meta` handleKey ' 0' 0
175174 >||< alt [' a' .. ' z' ] `meta` handleKey ' a' 10
176- handleKey base off cs st =
175+ handleKey base off cs sst =
177176 (with do
178- ph <- getsST playHist
177+ phm <- getsST histVisible
179178 for_
180- do ph Seq. !? (fromEnum (head cs) - (fromEnum base - off))
181- do jump . snd
179+ do phm >>= ( !? (fromEnum (head cs) - (fromEnum base - off) ))
180+ do jump . fst . snd
182181 hideHist
183182 touchST
184- , st
183+ , sst
185184 , Just allKeys
186185 )
186+ -- Compatibility: List.!? only added in GHC 9.8
187+ xs !? n = listToMaybe $ drop n xs
187188
188189------------------------------------------------------------------------
189190
190191confirmQuit :: LexerS
191192confirmQuit = char ' q' `meta`
192- \ _ st -> (with (forcePause *> toggleExit *> touchST), st , Just inner) where
193- inner = alt any' `meta` (\ _ st -> (with (toggleExit *> touchST), st , Just allKeys))
194- >||< char ' y' `meta` (\ _ st -> (with $ quit Nothing , st , Nothing ))
193+ \ _ sst -> (with (forcePause *> toggleExit *> touchST), sst , Just inner) where
194+ inner = alt any' `meta` (\ _ sst -> (with (toggleExit *> touchST), sst , Just allKeys))
195+ >||< char ' y' `meta` (\ _ sst -> (with $ quit Nothing , sst , Nothing ))
195196
196197------------------------------------------------------------------------
197198
0 commit comments