[GHC] #9367: :list does not underline expression correctly in WinGHCi for files with Windows-style newlines

#9367: :list does not underline expression correctly in WinGHCi for files with Windows-style newlines ----------------------------------+--------------------------------------- Reporter: kraai | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 7.6.3 Keywords: | Operating System: Windows Architecture: x86_64 (amd64) | Type of failure: None/Unknown Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+--------------------------------------- When I load a file that uses Windows-style newlines in WinGHCi, set a breakpoint, run to that breakpoint, and execute ":list", the carets that should underline the breakpoint expression are instead appended to the line. I'll attach a screenshot and the file I loaded. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9367 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9367: :list does not underline expression correctly in WinGHCi for files with Windows-style newlines ---------------------------------------+---------------------------------- Reporter: kraai | Owner: gintas Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 7.6.3 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: Differential Revisions: | ---------------------------------------+---------------------------------- Changes (by gintas): * owner: => gintas Comment: I could reproduce the bug on winghci 1.0.6 bundled with Haskell Platform 2014.2.0.0 (ghc 7.8.3). The problem does not appear when running ghc from an msys terminal or a Windows command shell. However, I looked into it more closely and it looks like ghci is indeed at fault. There is some funny business going on with line endings. In the part that is the source listing, newlines are not <CR><LF>, but <CR><CR><LF>. That's probably what's confusing WinGHCI. My guess is that something is not stripping the <CR><LF> from the source properly and then tries to append <CR><LF> on its own. To illustrate, the additional <CR>s show up as ^M: a :: Int = 8 left :: [Int] = _ right :: [Int] = _ [C:\users\gintas\temp\qsort.hs:2:16-47] *Main> 1 qsort [] = []^M 2 qsort (a:as) = qsort left ++ [a] ++ qsort right^M ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 where (left,right) = (filter (<=a) as, filter (>a) as)^M [C:\users\gintas\temp\qsort.hs:2:16-47] *Main> Leaving GHCi. Produced using: echo -e ':l qsort.hs \n:b 2\n:main\n:list' | TERM=dumb /tmp/ghc/bin/ghc.exe --interactive > /tmp/out The issue is still there in ghc HEAD. Let me take a look. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9367#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9367: :list does not underline expression correctly in WinGHCi for files with Windows-style newlines ---------------------------------------+---------------------------------- Reporter: kraai | Owner: gintas Type: bug | Status: patch Priority: normal | Milestone: Component: GHCi | Version: 7.6.3 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: Differential Revisions: Phab:D382 | ---------------------------------------+---------------------------------- Changes (by gintas): * status: new => patch * differential: => Phab:D382 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9367#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9367: GHCI :list uses malformed line endings (<CR><CR><LF>) on Windows ---------------------------------------+---------------------------------- Reporter: kraai | Owner: gintas Type: bug | Status: patch Priority: normal | Milestone: Component: GHCi | Version: 7.6.3 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: Differential Revisions: Phab:D382 | ---------------------------------------+---------------------------------- Comment (by gintas): I've confirmed that the patch addresses the issue in WinGhci too. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9367#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9367: GHCI :list uses malformed line endings (<CR><CR><LF>) on Windows
---------------------------------------+----------------------------------
Reporter: kraai | Owner: gintas
Type: bug | Status: patch
Priority: normal | Milestone:
Component: GHCi | Version: 7.6.3
Resolution: | Keywords:
Operating System: Windows | Architecture: x86_64 (amd64)
Type of failure: None/Unknown | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Revisions: Phab:D382 |
---------------------------------------+----------------------------------
Comment (by Austin Seipp

#9367: GHCI :list uses malformed line endings (<CR><CR><LF>) on Windows ---------------------------------------+---------------------------------- Reporter: kraai | Owner: gintas Type: bug | Status: closed Priority: normal | Milestone: Component: GHCi | Version: 7.6.3 Resolution: fixed | Keywords: Operating System: Windows | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: Differential Revisions: Phab:D382 | ---------------------------------------+---------------------------------- Changes (by gintas): * status: patch => closed * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9367#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC