@@ -166,8 +166,8 @@ processNetCmd orig i h fn cmd
166166 Left err -> do hPutStrLn h (show err)
167167 return (i, fn)
168168 where
169− processNet fn Reload = processNet fn (Load fn)
170− processNet fn (Load f) =
169+ processNet fn Reload = processNet fn (Load fn Nothing)
170+ processNet fn (Load f toline) =
171171 do let ist = orig { idris_options = idris_options i
172172 , idris_colourTheme = idris_colourTheme i
173173 , idris_colourRepl = False
@@ -177,7 +177,7 @@ processNetCmd orig i h fn cmd
177177 setOutH h
178178 setQuiet True
179179 setVerbose False
180− mods <- loadInputs h [f]
180+ mods <- loadInputs h [f] toline
181181 ist <- getIState
182182 return (ist, f)
183183 processNet fn c = do process h fn c
@@ -258,7 +258,7 @@ runIdeSlaveCommand id orig fn mods (IdeSlave.LoadFile filename) =
258258 clearErr
259259 putIState (orig { idris_options = idris_options i,
260260 idris_outputmode = (IdeSlave id) })
261− loadInputs stdout [filename]
261+ loadInputs stdout [filename] Nothing
262262 isetPrompt (mkPrompt [filename])
263263 -- Report either success or failure
264264 i <- getIState
@@ -474,14 +474,14 @@ processInput cmd orig inputs
474474 , idris_colourTheme = idris_colourTheme i
475475 }
476476 clearErr
477− mods <- loadInputs stdout inputs
477+ mods <- loadInputs stdout inputs Nothing
478478 return (Just inputs)
479− Success (Load f) ->
479+ Success (Load f toline) ->
480480 do putIState orig { idris_options = idris_options i
481481 , idris_colourTheme = idris_colourTheme i
482482 }
483483 clearErr
484− mod <- loadInputs stdout [f]
484+ mod <- loadInputs stdout [f] toline
485485 return (Just [f])
486486 Success (ModImport f) ->
487487 do clearErr
@@ -530,7 +530,7 @@ edit f orig
530530 putIState $ orig { idris_options = idris_options i
531531 , idris_colourTheme = idris_colourTheme i
532532 }
533− loadInputs stdout [f]
533+ loadInputs stdout [f] Nothing
534534-- clearOrigPats
535535 iucheck
536536 return ()
@@ -994,8 +994,8 @@ idris opts = do res <- runErrorT $ execStateT totalMain idrisInit
994994 [] -> return ()
995995
996996
997−loadInputs :: Handle -> [FilePath] -> Idris ()
998−loadInputs h inputs
997+loadInputs :: Handle -> [FilePath] -> Maybe Int -> Idris ()
998+loadInputs h inputs toline -- furthest line to read in input source files
999999 = idrisCatch
10001000 (do ist <- getIState
10011001 -- if we're in --check and not outputting anything, don't bother
@@ -1056,7 +1056,18 @@ loadInputs h inputs
10561056 tryLoad keepstate [] = warnTotality >> return ()
10571057 tryLoad keepstate (f : fs)
10581058 = do ist <- getIState
1059− loadFromIFile h f
1059+ let maxline
1060+ = case toline of
1061+ Nothing -> Nothing
1062+ Just l -> case f of
1063+ IDR fn -> if any (fmatch fn) inputs
1064+ then Just l
1065+ else Nothing
1066+ LIDR fn -> if any (fmatch fn) inputs
1067+ then Just l
1068+ else Nothing
1069+ _ -> Nothing
1070+ loadFromIFile h f maxline
10601071 inew <- getIState
10611072 -- FIXME: Save these in IBC to avoid this hack! Need to
10621073 -- preserve it all from source inputs
@@ -1072,6 +1083,10 @@ loadInputs h inputs
10721083 ibc (IBC _ _) = True
10731084 ibc _ = False
10741085
1086+ fmatch ('.':'/':xs) ys = fmatch xs ys
1087+ fmatch xs ('.':'/':ys) = fmatch xs ys
1088+ fmatch xs ys = xs == ys
1089+
10751090 findNewIBC :: IFileType -> Idris (Maybe IFileType)
10761091 findNewIBC i@(IBC _ _) = return (Just i)
10771092 findNewIBC s@(IDR f) = do ist <- get
@@ -1181,7 +1196,7 @@ idrisMain opts =
11811196 iputStrLn banner
11821197
11831198 orig <- getIState
1184− loadInputs stdout inputs
1199+ loadInputs stdout inputs Nothing
11851200
11861201 runIO $ hSetBuffering stdout LineBuffering
11871202
@@ -1278,7 +1293,7 @@ initScript = do script <- getInitScript
12781293 case parseCmd i input cmd of
12791294 Failure err -> runIO $ print (fixColour clr err)
12801295 Success Reload -> iPrintError "Init scripts cannot reload the file"
1281− Success (Load f) -> iPrintError "Init scripts cannot load files"
1296+ Success (Load f _) -> iPrintError "Init scripts cannot load files"
12821297 Success (ModImport f) -> iPrintError "Init scripts cannot import modules"
12831298 Success Edit -> iPrintError "Init scripts cannot invoke the editor"
12841299 Success Proofs -> proofs i