Commit 45175e13 authored by gintas's avatar gintas Committed by Austin Seipp

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
parent acb3295c
......@@ -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)
......
......@@ -39,3 +39,8 @@ ghci056_setup:
T6106_prep:
'$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make T6106_preproc
.PHONY: T9367
T9367:
'$(TEST_HC)' $(TEST_HC_OPTS) --interactive -v0 -ignore-dot-ghci < T9367.script > T9367-raw.run.stdout
cmp T9367-raw.run.stdout T9367-raw.stdout
Breakpoint 0 activated at T9367.hs:1:5-9
"Stopped at T9367.hs:1:5-9
_result :: [Char] = _
1 x = "abc"
^^^^^
2 main = print x
......@@ -43,6 +43,10 @@ test('ghci024',
when(fast(), skip),
run_command,
['$MAKE -s --no-print-directory ghci024'])
test('T9367',
when(fast() or config.os != 'mingw32', skip),
run_command,
['$MAKE -s --no-print-directory T9367'])
test('ghci025', normal, ghci_script, ['ghci025.script'])
test('ghci026', normal, ghci_script, ['ghci026.script'])
......
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