X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fghci%2FInteractiveUI.hs;h=4db8900a2b30794fd96618a04d12c312b10c803d;hb=ff8799ef2c8d0ab976fa9fc00fc4bc94e1ca5af9;hp=e385f6bb4659552ffe37033dfba6879a4e52897b;hpb=758baa7c72043c44c91c0ba4f1fb7910cd7aa520;p=ghc-hetmet.git diff --git a/compiler/ghci/InteractiveUI.hs b/compiler/ghci/InteractiveUI.hs index e385f6b..4db8900 100644 --- a/compiler/ghci/InteractiveUI.hs +++ b/compiler/ghci/InteractiveUI.hs @@ -393,10 +393,9 @@ withTerminalReset f = do isTTY <- liftIO $ hIsTerminalDevice stdout if not isTTY then f - else do - oldAttrs <- liftIO $ getTerminalAttributes stdOutput - f - liftIO $ setTerminalAttributes stdOutput oldAttrs Immediately + else gbracket (liftIO $ getTerminalAttributes stdOutput) + (\attrs -> liftIO $ setTerminalAttributes stdOutput attrs Immediately) + (const f) #endif runGHCi :: [(FilePath, Maybe Phase)] -> Maybe [String] -> GHCi () @@ -1500,10 +1499,13 @@ setPrompt value = do st <- getGHCiState if null value then io $ hPutStrLn stderr $ "syntax: :set prompt , currently \"" ++ prompt st ++ "\"" - else setGHCiState st{ prompt = remQuotes value } - where - remQuotes ('\"':xs) | not (null xs) && last xs == '\"' = init xs - remQuotes x = x + else case value of + '\"' : _ -> case reads value of + [(value', xs)] | all isSpace xs -> + setGHCiState (st { prompt = value' }) + _ -> + io $ hPutStrLn stderr "Can't parse prompt string. Use Haskell syntax." + _ -> setGHCiState (st { prompt = value }) setOptions wds = do -- first, deal with the GHCi opts (+s, +t, etc.)