X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fghci%2FInteractiveUI.hs;h=30f1de6d275d7d51c58217ffb34c085b7e6b550e;hb=a0b2691bb9116d06bc6a3a16b36388b477791224;hp=e712e9dfd80f8870e696872cc51d31f52eebdd63;hpb=b25d67d4c0398dbceca0165c3b43df0625e1e06a;p=ghc-hetmet.git diff --git a/compiler/ghci/InteractiveUI.hs b/compiler/ghci/InteractiveUI.hs index e712e9d..30f1de6 100644 --- a/compiler/ghci/InteractiveUI.hs +++ b/compiler/ghci/InteractiveUI.hs @@ -54,6 +54,7 @@ import System.Posix hiding (getEnv) #else import GHC.ConsoleHandler ( flushConsole ) import qualified System.Win32 +import System.FilePath #endif #ifdef USE_READLINE @@ -158,11 +159,15 @@ builtin_commands = [ -- -- NOTE: in order for us to override the default correctly, any custom entry -- must be a SUBSET of word_break_chars. -word_break_chars, flagWordBreakChars, filenameWordBreakChars :: String +#ifdef USE_READLINE +word_break_chars :: String word_break_chars = let symbols = "!#$%&*+/<=>?@\\^|-~" specials = "(),;[]`{}" spaces = " \t\n" in spaces ++ specials ++ symbols +#endif + +flagWordBreakChars, filenameWordBreakChars :: String flagWordBreakChars = " \t\n" filenameWordBreakChars = " \t\n\\`@$><=;|&{(" -- bash defaults @@ -2134,9 +2139,23 @@ listCmd :: String -> GHCi () listCmd "" = do mb_span <- getCurrentBreakSpan case mb_span of - Nothing -> printForUser $ text "not stopped at a breakpoint; nothing to list" - Just span | GHC.isGoodSrcSpan span -> io $ listAround span True - | otherwise -> printForUser $ text "unable to list source for" <+> ppr span + Nothing -> + printForUser $ text "Not stopped at a breakpoint; nothing to list" + Just span + | GHC.isGoodSrcSpan span -> io $ listAround span True + | otherwise -> + do s <- getSession + resumes <- io $ GHC.getResumeContext s + case resumes of + [] -> panic "No resumes" + (r:_) -> + do let traceIt = case GHC.resumeHistory r of + [] -> text "rerunning with :trace," + _ -> empty + doWhat = traceIt <+> text ":back then :list" + printForUser (text "Unable to list source for" <+> + ppr span + $$ text "Try" <+> doWhat) listCmd str = list2 (words str) list2 :: [String] -> GHCi ()