diff options
author | Gintautas Miliauskas <gintautas.miliauskas@gmail.com> | 2014-10-29 23:14:17 -0500 |
---|---|---|
committer | Austin Seipp <austin@well-typed.com> | 2014-10-29 23:14:17 -0500 |
commit | 45175e13edad452843207491d01cdbce0bedbbd4 (patch) | |
tree | 521b1ad056cfe3fb063f66e7e604d313a7815ac9 /ghc | |
parent | acb3295c69179159ba8230baff4104414c1db2c2 (diff) | |
download | haskell-45175e13edad452843207491d01cdbce0bedbbd4.tar.gz |
Extra CRs are now filtered out from the source file for :list.
Fixes #9367.
Reviewers: austin
Reviewed By: austin
Subscribers: #ghc_windows_task_force, thomie, carter, simonmar
Differential Revision: https://phabricator.haskell.org/D382
GHC Trac Issues: #9367
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 3192d20857..ed4ea7bdfd 100644 --- a/ghc/InteractiveUI.hs +++ b/ghc/InteractiveUI.hs @@ -2934,7 +2934,8 @@ listModuleLine modl line = do listAround :: MonadIO m => RealSrcSpan -> Bool -> InputT m () listAround pan do_highlight = do contents <- liftIO $ BS.readFile (unpackFS file) - let ls = BS.split '\n' contents + -- Drop carriage returns to avoid duplicates, see #9367. + let ls = BS.split '\n' $ BS.filter (/= '\r') contents ls' = take (line2 - line1 + 1 + pad_before + pad_after) $ drop (line1 - 1 - pad_before) $ ls fst_line = max 1 (line1 - pad_before) |