Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove internal completion function and just use identical simpleCompletion #152

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions System/Console/Haskeline/Completion.hs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ completeWordWithPrev esc ws f (line, _) = do

-- | Create a finished completion out of the given word.
simpleCompletion :: String -> Completion
simpleCompletion = completion
simpleCompletion = Completion str str True

-- NOTE: this is the same as for readline, except that I took out the '\\'
-- so they can be used as a path separator.
Expand All @@ -99,9 +99,6 @@ completeFilename = completeQuotedWord (Just '\\') "\"'" listFiles
$ completeWord (Just '\\') ("\"\'" ++ filenameWordBreakChars)
listFiles

completion :: String -> Completion
completion str = Completion str str True

setReplacement :: (String -> String) -> Completion -> Completion
setReplacement f c = c {replacement = f $ replacement c}

Expand Down Expand Up @@ -165,7 +162,7 @@ listFiles path = liftIO $ do
-- get all of the files in that directory, as basenames
allFiles <- if not dirExists
then return []
else fmap (map completion . filterPrefix)
else fmap (map simpleCompletion . filterPrefix)
$ getDirectoryContents fixedDir
-- The replacement text should include the directory part, and also
-- have a trailing slash if it's itself a directory.
Expand Down