summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaroReinders <>2017-11-03 10:35:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2017-11-03 10:35:00 (GMT)
commit79da868fcd6ef48302a28b013ff2cd14026cb877 (patch)
tree29c5cb970d7cb75d631b7e8139e8b743efccd798
parent7e55c40bb1d5ef5ba18f415899822cd3875bf44e (diff)
version 0.17.10.17.1
-rw-r--r--src/Yi/Fuzzy.hs28
-rw-r--r--yi-fuzzy-open.cabal6
2 files changed, 16 insertions, 18 deletions
diff --git a/src/Yi/Fuzzy.hs b/src/Yi/Fuzzy.hs
index fd42865..0cb48d2 100644
--- a/src/Yi/Fuzzy.hs
+++ b/src/Yi/Fuzzy.hs
@@ -64,15 +64,13 @@ data FuzzyItem
instance Show FuzzyItem where
show :: FuzzyItem -> String
- show i = case i of
- FileItem _ -> "File " <> itemAsStr i
- BufferItem _ -> "Buffer " <> itemAsStr i
+ show i@(FileItem _) = "File " <> itemAsStr i
+ show i@(BufferItem _) = "Buffer " <> itemAsStr i
itemAsTxt :: FuzzyItem -> Text
-itemAsTxt f = case f of
- FileItem x -> x
- BufferItem (MemBuffer x) -> x
- BufferItem (FileBuffer x) -> T.pack x
+itemAsTxt (FileItem x) = x
+itemAsTxt (BufferItem (MemBuffer x)) = x
+itemAsTxt (BufferItem (FileBuffer x)) = T.pack x
itemAsStr :: FuzzyItem -> String
itemAsStr = T.unpack . itemAsTxt
@@ -197,13 +195,14 @@ changeIndex :: (PointedList FuzzyItem -> Maybe (PointedList FuzzyItem)) -> Fuzzy
changeIndex dir fs = fs { items = items fs >>= dir }
renderE :: FuzzyState -> EditorM ()
-renderE (FuzzyState maybeZipper s) = do
+renderE (FuzzyState maybeZipper s) =
case mcontent of
Nothing -> printMsg "No match found"
Just content -> setStatus (toList content, defaultStyle)
where
tshow :: Show s => s -> Text
tshow = T.pack . show
+
mcontent :: Maybe (NonEmpty Text)
mcontent = do
zipper <- maybeZipper
@@ -238,13 +237,12 @@ openRoutine preOpenAction = do
action f
where
action :: FuzzyItem -> YiM ()
- action fi = case fi of
- FileItem x -> void (editFile (T.unpack x))
- BufferItem x -> withEditor $ do
- bufs <- gets (M.assocs . buffers)
- case filter ((==x) . ident . attributes . snd) bufs of
- [] -> error ("Couldn't find " <> show x)
- (bufRef, _):_ -> switchToBufferE bufRef
+ action (FileItem x) = void (editFile (T.unpack x))
+ action (BufferItem x) = withEditor $ do
+ bufs <- gets (M.assocs . buffers)
+ case filter ((==x) . ident . attributes . snd) bufs of
+ [] -> error ("Couldn't find " <> show x)
+ (bufRef, _):_ -> switchToBufferE bufRef
insertChar :: Keymap
diff --git a/yi-fuzzy-open.cabal b/yi-fuzzy-open.cabal
index acdb72e..88ebf69 100644
--- a/yi-fuzzy-open.cabal
+++ b/yi-fuzzy-open.cabal
@@ -1,5 +1,5 @@
name: yi-fuzzy-open
-version: 0.17.0
+version: 0.17.1
synopsis: Fuzzy open plugin for yi
description: This plugin tries to do what ctrl-p does for vim and helm does for emacs.
category: Yi
@@ -30,8 +30,8 @@ library
, text >= 1.2
, transformers-base >= 0.4.4
, vector >= 0.11
- , yi-core >= 0.17.0
- , yi-language >= 0.16.0
+ , yi-core >= 0.17
+ , yi-language >= 0.17
, yi-rope >= 0.10
exposed-modules:
Yi.Fuzzy