diff options
Diffstat (limited to 'src-3.0/GF/System/UseReadline.hs')
| -rw-r--r-- | src-3.0/GF/System/UseReadline.hs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src-3.0/GF/System/UseReadline.hs b/src-3.0/GF/System/UseReadline.hs index c84b9d7f4..c4a8f9239 100644 --- a/src-3.0/GF/System/UseReadline.hs +++ b/src-3.0/GF/System/UseReadline.hs @@ -12,9 +12,9 @@ -- Use GNU readline ----------------------------------------------------------------------------- -module GF.System.UseReadline (fetchCommand) where +module GF.System.UseReadline (fetchCommand, setCompletionFunction) where -import System.Console.Readline (readline, addHistory) +import System.Console.Readline fetchCommand :: String -> IO (String) fetchCommand s = do @@ -23,3 +23,12 @@ fetchCommand s = do Nothing -> return "q" Just s -> do addHistory s return s + +setCompletionFunction :: Maybe (String -> String -> Int -> IO [String]) -> IO () +setCompletionFunction Nothing = setCompletionEntryFunction Nothing +setCompletionFunction (Just fn) = setCompletionEntryFunction (Just my_fn) + where + my_fn prefix = do + s <- getLineBuffer + p <- getPoint + fn s prefix p |
