@@ -444,19 +444,22 @@ genericJumpToMatch :: Lookup a
444444 -> (Int -> HState -> Int )
445445 -> IO ()
446446genericJumpToMatch re sw k sel = do
447- found <- modifyHS \ st -> let
447+ mmsg <- modifyHS \ st -> let
448448 info = case re of
449449 Just s -> Just (st { searchFw = sw }, s, sw)
450450 _ -> listToMaybe [ (st, s, st. searchFw == sw) | s <- st. searchHist ]
451- in flip (maybe (st, False )) info \ (st', p, forwards) -> do
451+ in flip (maybe (st, Just " No previous search." )) info
452+ \ (st', p, forwards) -> do
452453 let (fs, cur, m) = k st
453454 l = if forwards then [cur+ 1 .. m- 1 ] ++ [0 .. cur]
454455 else [cur- 1 , cur- 2 .. 0 ] ++ [m- 1 , m- 2 .. cur]
455- match = matches p
456- case [ i | i <- l, match $ extract (fs ! i) ] of
457- i: _ -> (st' { cursor = sel i st }, True )
458- _ -> (st', False )
459- unless found $ putMessage [plainSeg " No match found." ]
456+ case matches p of
457+ Just match ->
458+ case [ i | i <- l, match $ extract (fs ! i) ] of
459+ i: _ -> (st' { cursor = sel i st }, Nothing )
460+ _ -> (st', Just " No match found." )
461+ _ -> (st', Just " Invalid ERE search pattern." )
462+ whenJust mmsg \ msg -> putMessage [plainSeg msg]
460463
461464------------------------------------------------------------------------
462465
0 commit comments