aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Prompt
diff options
context:
space:
mode:
authorAdam Vogt <vogt.adam@gmail.com>2011-11-11 22:56:55 +0100
committerAdam Vogt <vogt.adam@gmail.com>2011-11-11 22:56:55 +0100
commit361e727a7844e5fd2ea7eaa0d6b1d4fc0a5c0b68 (patch)
tree778733c0875a4849196d9c6ea35d44cd6d220b9f /XMonad/Prompt
parent57104d28551d64c35d6d0fc5d6aa9e7f763c87b1 (diff)
downloadXMonadContrib-361e727a7844e5fd2ea7eaa0d6b1d4fc0a5c0b68.tar.gz
XMonadContrib-361e727a7844e5fd2ea7eaa0d6b1d4fc0a5c0b68.tar.xz
XMonadContrib-361e727a7844e5fd2ea7eaa0d6b1d4fc0a5c0b68.zip
Correct completions of utf8-named file in X.P.Shell
Ignore-this: 9aa10143f313b06afdb11e61777a7d20 darcs-hash:20111111215655-1499c-778c2896f89bf1085217059c72b05857c04931a2.gz
Diffstat (limited to 'XMonad/Prompt')
-rw-r--r--XMonad/Prompt/Shell.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/XMonad/Prompt/Shell.hs b/XMonad/Prompt/Shell.hs
index 9ed9293..da55f48 100644
--- a/XMonad/Prompt/Shell.hs
+++ b/XMonad/Prompt/Shell.hs
@@ -24,7 +24,7 @@ module XMonad.Prompt.Shell
, safePrompt
) where
-import Codec.Binary.UTF8.String (decodeString, encodeString)
+import Codec.Binary.UTF8.String (encodeString)
import Control.Exception
import Control.Monad (forM)
import Data.List (isPrefixOf)
@@ -88,13 +88,14 @@ unsafePrompt c config = mkXPrompt Shell config (getShellCompl [c]) run
getShellCompl :: [String] -> String -> IO [String]
getShellCompl cmds s | s == "" || last s == ' ' = return []
| otherwise = do
- f <- fmap lines $ runProcessWithInput "bash" [] ("compgen -A file " ++ encodeString s ++ "\n")
+ f <- fmap lines $ runProcessWithInput "bash" [] ("compgen -A file -- "
+ ++ s ++ "\n")
files <- case f of
- [x] -> do fs <- getFileStatus x
+ [x] -> do fs <- getFileStatus (encodeString x)
if isDirectory fs then return [x ++ "/"]
else return [x]
_ -> return f
- return . map decodeString . uniqSort $ files ++ commandCompletionFunction cmds s
+ return . uniqSort $ files ++ commandCompletionFunction cmds s
commandCompletionFunction :: [String] -> String -> [String]
commandCompletionFunction cmds str | '/' `elem` str = []