@@ -64,15 +64,13 @@ data FuzzyItem
64
64
65
65
instance Show FuzzyItem where
66
66
show :: FuzzyItem -> String
67
- show i = case i of
68
- FileItem _ -> " File " <> itemAsStr i
69
- BufferItem _ -> " Buffer " <> itemAsStr i
67
+ show i@ (FileItem _) = " File " <> itemAsStr i
68
+ show i@ (BufferItem _) = " Buffer " <> itemAsStr i
70
69
71
70
itemAsTxt :: FuzzyItem -> Text
72
- itemAsTxt f = case f of
73
- FileItem x -> x
74
- BufferItem (MemBuffer x) -> x
75
- BufferItem (FileBuffer x) -> T. pack x
71
+ itemAsTxt (FileItem x) = x
72
+ itemAsTxt (BufferItem (MemBuffer x)) = x
73
+ itemAsTxt (BufferItem (FileBuffer x)) = T. pack x
76
74
77
75
itemAsStr :: FuzzyItem -> String
78
76
itemAsStr = T. unpack . itemAsTxt
@@ -197,13 +195,14 @@ changeIndex :: (PointedList FuzzyItem -> Maybe (PointedList FuzzyItem)) -> Fuzzy
197
195
changeIndex dir fs = fs { items = items fs >>= dir }
198
196
199
197
renderE :: FuzzyState -> EditorM ()
200
- renderE (FuzzyState maybeZipper s) = do
198
+ renderE (FuzzyState maybeZipper s) =
201
199
case mcontent of
202
200
Nothing -> printMsg " No match found"
203
201
Just content -> setStatus (toList content, defaultStyle)
204
202
where
205
203
tshow :: Show s => s -> Text
206
204
tshow = T. pack . show
205
+
207
206
mcontent :: Maybe (NonEmpty Text )
208
207
mcontent = do
209
208
zipper <- maybeZipper
@@ -238,13 +237,12 @@ openRoutine preOpenAction = do
238
237
action f
239
238
where
240
239
action :: FuzzyItem -> YiM ()
241
- action fi = case fi of
242
- FileItem x -> void (editFile (T. unpack x))
243
- BufferItem x -> withEditor $ do
244
- bufs <- gets (M. assocs . buffers)
245
- case filter ((== x) . ident . attributes . snd ) bufs of
246
- [] -> error (" Couldn't find " <> show x)
247
- (bufRef, _): _ -> switchToBufferE bufRef
240
+ action (FileItem x) = void (editFile (T. unpack x))
241
+ action (BufferItem x) = withEditor $ do
242
+ bufs <- gets (M. assocs . buffers)
243
+ case filter ((== x) . ident . attributes . snd ) bufs of
244
+ [] -> error (" Couldn't find " <> show x)
245
+ (bufRef, _): _ -> switchToBufferE bufRef
248
246
249
247
250
248
insertChar :: Keymap
0 commit comments