haskell / winghci

Simple Windows GUI for GHCi.
https://code.google.com/p/winghci/
Other
17 stars 10 forks source link

The & prefix on editor option does not work properly when a file has errors #10

Open oerjan opened 8 years ago

oerjan commented 8 years ago

I've just got set up with the Haskell Platform again after a major crash, and installed the new one with GHC 8.0. I'm using Windows 10.

As usual, I've set my editor option to &gvim, so that I can just fire up the editor from inside WinGHCi but still not lock up the latter. However, this no longer works when a file contains errors at startup. I usually try not to leave files around with errors in them, but GHC sometimes gets stricter. My dabbling-around file C.hs started with module Main where but had no actual main, which is now an error:

Prelude> :l C
[1 of 2] Compiling Basic            ( Basic.hs, interpreted )
[2 of 2] Compiling Main             ( C.hs, interpreted )

C.hs:1:1: error:
    The IO action ‘main’ is not defined in module ‘Main’
Failed, modules loaded: Basic.
*Basic> :e

After this, GVIM opens, but the file name is the incorrect C.hs +1.

From what I can see, the problem is with the StartProcess.exe helper program which WinGHCi uses for the & prefix: It doesn't understand GHCi :e's +linenumber option and passes it on as part of the filename argument.

Using just gvim as the option works, but locks up WinGHCi.

(Well, that's with GVIM, which understands the +1 option itself. Notepad isn't that lucky, as I accidentally discovered while testing with plain GHCi on the command line. I didn't see any option to disable passing line numbers from GHCi, which might be considered a bug in that.)