summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkrasimir <krasimir@chalmers.se>2008-10-22 11:27:01 +0000
committerkrasimir <krasimir@chalmers.se>2008-10-22 11:27:01 +0000
commit9ba3b739dffb80e0799fc22c714c897d72f5e4d2 (patch)
treeb23a8576372006bdba5135cb19dd0716eb10f932
parentbb007215ab55f3ecc198afd050c25eecc96cbc34 (diff)
fix the word completion in the shell
-rw-r--r--src/GFI.hs14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/GFI.hs b/src/GFI.hs
index ccd19900d..16456fb1a 100644
--- a/src/GFI.hs
+++ b/src/GFI.hs
@@ -271,10 +271,14 @@ wc_type = cmd_name
| isIdent c = ident x (c:cs) cs
| otherwise = cmd x cs
- option x y [] = ret CmplOpt x y 1
- option x y (c:cs)
- | isIdent c = option x y cs
- | otherwise = cmd x cs
+ option x y [] = ret CmplOpt x y 1
+ option x y ('=':cs) = optValue x y cs
+ option x y (c :cs)
+ | isIdent c = option x y cs
+ | otherwise = cmd x cs
+
+ optValue x y ('"':cs) = str x y cs
+ optValue x y cs = cmd x cs
ident x y [] = ret CmplIdent x y 0
ident x y (c:cs)
@@ -289,7 +293,7 @@ wc_type = cmd_name
ret f x y d = f cmd y
where
x1 = take (length x - length y - d) x
- x2 = takeWhile (\c -> isIdent c || isSpace c || c == '-' || c == '=') x1
+ x2 = takeWhile (\c -> isIdent c || isSpace c || c == '-' || c == '=' || c == '"') x1
cmd = case [x | (x,cs) <- RP.readP_to_S pCommand x2, all isSpace cs] of
[x] -> Just x