@@ -786,10 +786,10 @@ edit f orig
786786 env <- runIO getEnvironment
787787 let editor = getEditor env
788788 let line = case errSpan i of
789− Just l -> ['+' : show (fst (fc_start l))]
790− Nothing -> []
791− let args = line ++ [fixName f]
792− runIO $ rawSystem editor args
789+ Just l -> '+' : show (fst (fc_start l))
790+ Nothing -> ""
791+ let cmdLine = intercalate " " [editor, line, fixName f]
792+ runIO $ system cmdLine
793793 clearErr
794794 -- The $!! here prevents a space leak on reloading.
795795 -- This isn't a solution - but it's a temporary stopgap.
@@ -804,8 +804,11 @@ edit f orig
804804 where getEditor env | Just ed <- lookup "EDITOR" env = ed
805805 | Just ed <- lookup "VISUAL" env = ed
806806 | otherwise = "vi"
807− fixName file | map toLower (takeExtension file) `elem` [".lidr", ".idr"] = file
808− | otherwise = addExtension file "idr"
807+ fixName file | map toLower (takeExtension file) `elem` [".lidr", ".idr"] = quote file
808+ | otherwise = quote $ addExtension file "idr"
809+ where
810+ quoteChar = if isWindows then '"' else '\''
811+ quote s = [quoteChar] ++ s ++ [quoteChar]
809812
810813
811814