Commit be3eef90 authored by Ian Lynagh's avatar Ian Lynagh
Browse files

don't initialize readline needlessly

Readline.initialize spills some escape sequences to stdout for some terminal
types, potentially spoiling  ghc -e  output. So don't initialize readline
unless we're working interactively on a terminal.
Patch from Bertram Felgenhauer <int-e@gmx.de>
parent edd77427
......@@ -298,21 +298,21 @@ interactiveUI session srcs maybe_expr = do
-- intended for the program, so unbuffer stdin.
hSetBuffering stdin NoBuffering
-- initial context is just the Prelude
prel_mod <- GHC.findModule session (GHC.mkModuleName "Prelude")
(Just basePackageId)
GHC.setContext session [] [prel_mod]
#ifdef USE_READLINE
Readline.initialize
Readline.setAttemptedCompletionFunction (Just completeWord)
--Readline.parseAndBind "set show-all-if-ambiguous 1"
Readline.initialize
Readline.setAttemptedCompletionFunction (Just completeWord)
--Readline.parseAndBind "set show-all-if-ambiguous 1"
Readline.setBasicWordBreakCharacters word_break_chars
Readline.setCompleterWordBreakCharacters word_break_chars
Readline.setCompletionAppendCharacter Nothing
Readline.setBasicWordBreakCharacters word_break_chars
Readline.setCompleterWordBreakCharacters word_break_chars
Readline.setCompletionAppendCharacter Nothing
#endif
-- initial context is just the Prelude
prel_mod <- GHC.findModule session (GHC.mkModuleName "Prelude")
(Just basePackageId)
GHC.setContext session [] [prel_mod]
default_editor <- findEditor
startGHCi (runGHCi srcs maybe_expr)
......
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