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