Commit ff8799ef authored by Ian Lynagh's avatar Ian Lynagh

:set prompt now understand Haskell String syntax; trace #2652

parent 2dce32ca
...@@ -1499,10 +1499,13 @@ setPrompt value = do ...@@ -1499,10 +1499,13 @@ setPrompt value = do
st <- getGHCiState st <- getGHCiState
if null value if null value
then io $ hPutStrLn stderr $ "syntax: :set prompt <prompt>, currently \"" ++ prompt st ++ "\"" then io $ hPutStrLn stderr $ "syntax: :set prompt <prompt>, currently \"" ++ prompt st ++ "\""
else setGHCiState st{ prompt = remQuotes value } else case value of
where '\"' : _ -> case reads value of
remQuotes ('\"':xs) | not (null xs) && last xs == '\"' = init xs [(value', xs)] | all isSpace xs ->
remQuotes x = x setGHCiState (st { prompt = value' })
_ ->
io $ hPutStrLn stderr "Can't parse prompt string. Use Haskell syntax."
_ -> setGHCiState (st { prompt = value })
setOptions wds = setOptions wds =
do -- first, deal with the GHCi opts (+s, +t, etc.) do -- first, deal with the GHCi opts (+s, +t, etc.)
......
...@@ -2386,7 +2386,9 @@ bar ...@@ -2386,7 +2386,9 @@ bar
Inside <replaceable>prompt</replaceable>, the sequence Inside <replaceable>prompt</replaceable>, the sequence
<literal>%s</literal> is replaced by the names of the <literal>%s</literal> is replaced by the names of the
modules currently in scope, and <literal>%%</literal> is modules currently in scope, and <literal>%%</literal> is
replaced by <literal>%</literal>.</para> replaced by <literal>%</literal>. If <replaceable>prompt</replaceable>
starts with &quot; then it is parsed as a Haskell String;
otherwise it is treated as a literal string.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment