Commits

paradoxiology committed 4fd50d2

Some code clean-up
Removed some subreddits

Comments (0)

Files changed (1)

src/Navigation.hs

 
 commandList = ["open", "upvote", "downvote", "unvote", "back", "forward", "search", "login", "exit"]
 
+
 -- Popular subreddits
-subredditList = ["3DS", "4chan", "adviceanimals", "android", "apple", "art", "askreddit", "askscience", "atheism", "aww", "beer", "bestof", "blog", "books", "business", "canada", "circlejerk", "coding", "cogsci", "comics", "conspiracy", "cooking", "creepy", "design", "diy", "doesanybodyelse", "drugs", "earthporn", "economics", "entertainment", "environment", "explainlikeimfive", "fffffffuuuuuuuuuuuu", "firstworldproblems", "fitness", "food", "frugal", "funny", "gadgets", "gaming", "geek", "gifs", "gonewild", "guns", "happy", "haskell", "health", "history", "howto", "humor", "iama", "itookapicture", "kindle", "lgbt", "libertarian", "linux", "listentothis", "lolcats", "loseit", "malefashionadvice", "marijuana", "math", "minecraft", "movies", "music", "netsec", "news", "nsfw", "offbeat", "philosophy", "photography", "physics", "pics", "politics", "programming", "psychology", "reddit.com", "science", "scifi", "seduction", "self", "sex", "shutupandtakemymoney", "skeptic", "space", "sports", "starcraft", "technology", "tf2", "tldr", "todayilearned", "trees", "truereddit", "twoxchromosomes", "videos", "vim", "web_design", "webgames", "wikipedia", "woahdude", "worldnews", "worldpolitics", "wtf", "youshouldknow"]
+subredditList = ["3DS", "4chan", "adviceanimals", "android", "apple", "art", "askreddit", "askscience", "atheism", "aww", "beer", "bestof", "blog", "books", "business", "canada", "circlejerk", "coding", "cogsci", "comics", "conspiracy", "cooking", "creepy", "design", "diy", "doesanybodyelse", "earthporn", "economics", "entertainment", "environment", "explainlikeimfive", "fffffffuuuuuuuuuuuu", "firstworldproblems", "fitness", "food", "frugal", "funny", "gadgets", "gaming", "geek", "gifs", "gonewild", "guns", "happy", "haskell", "health", "history", "howto", "humor", "iama", "itookapicture", "kindle", "lgbt", "libertarian", "linux", "listentothis", "lolcats", "loseit", "malefashionadvice", "math", "minecraft", "movies", "music", "netsec", "news", "nsfw", "offbeat", "philosophy", "photography", "physics", "pics", "politics", "programming", "psychology", "reddit.com", "science", "scifi", "seduction", "self", "sex", "shutupandtakemymoney", "skeptic", "space", "sports", "starcraft", "technology", "tf2", "tldr", "todayilearned", "trees", "truereddit", "twoxchromosomes", "videos", "vim", "web_design", "webgames", "wikipedia", "woahdude", "worldnews", "worldpolitics", "wtf", "youshouldknow"]
 
-autocompleteLine cmd arg
-               | cmd == "" = map simpleCompletion $ filter (arg `isPrefixOf`) commandList
-               | cmd == " r" = map simpleCompletion $ filter (arg `isPrefixOf`) subredditList 
-               | otherwise = []
+
+autocompleteLine prev cur
+                | prev == ""   = complete cur commandList
+                | prev == " r" = complete cur subredditList
+                | otherwise    = []
+                    where complete str = (map simpleCompletion) . filter (str `isPrefixOf`)
+
 
 inputSettings :: MonadIO m => Settings m
 inputSettings = Settings { historyFile = Nothing,
-                           complete = completeWordWithPrev Nothing " \t" (\ a b -> return $ autocompleteLine a b),
+                           complete = completeWordWithPrev Nothing " \t" (\ prev cur -> return $ autocompleteLine prev cur),
                            autoAddHistory = True }