diff options
author | Herbert Valerio Riedel <hvr@gnu.org> | 2013-07-10 10:01:31 +0200 |
---|---|---|
committer | Herbert Valerio Riedel <hvr@gnu.org> | 2013-08-10 22:26:58 +0200 |
commit | 11814a8e2f1a5b1163cb1b00bfdc699436b40317 (patch) | |
tree | 68d08404f471f06cb9ed7c8bc56e5ad2390f3045 /ghc | |
parent | c08bf882d1763f740517557c03c0969df97e645d (diff) | |
download | haskell-11814a8e2f1a5b1163cb1b00bfdc699436b40317.tar.gz |
GHCi: Implement `%l` prompt substitution for line-number
This commit also updates the GHC user guide section
regarding the `set prompt` command and closes #8047.
Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
Diffstat (limited to 'ghc')
-rw-r--r-- | ghc/InteractiveUI.hs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs index dbc0c052ca..fd034eaf7d 100644 --- a/ghc/InteractiveUI.hs +++ b/ghc/InteractiveUI.hs @@ -609,6 +609,7 @@ fileLoop hdl = do mkPrompt :: GHCi String mkPrompt = do + st <- getGHCiState imports <- GHC.getContext resumes <- GHC.getResumeContext @@ -639,12 +640,12 @@ mkPrompt = do deflt_prompt = dots <> context_bit <> modules_bit + f ('%':'l':xs) = ppr (1 + line_number st) <> f xs f ('%':'s':xs) = deflt_prompt <> f xs f ('%':'%':xs) = char '%' <> f xs f (x:xs) = char x <> f xs f [] = empty - st <- getGHCiState dflags <- getDynFlags return (showSDoc dflags (f (prompt st))) |