@@ -590,12 +590,14 @@ process h fn (AddProofClauseFrom updatefile l n)
590process h fn (AddMissing updatefile l n)
590process h fn (AddMissing updatefile l n)
591 = do src <- runIO $ readFile fn
591 = do src <- runIO $ readFile fn
592 let (before, tyline : later) = splitAt (l-1) (lines src)
592 let (before, tyline : later) = splitAt (l-1) (lines src)
593+ let indent = getIndent 0 (show n) tyline
593 i <- getIState
594 i <- getIState
594 cl <- getInternalApp fn l
595 cl <- getInternalApp fn l
595 let n' = getAppName cl
596 let n' = getAppName cl
596 extras <- case lookupCtxt n' (idris_patdefs i) of
598 extras <- case lookupCtxt n' (idris_patdefs i) of
597 [] -> return ""
599 [] -> return ""
598− [(_, tms)] -> showNew (show n ++ "_rhs") 1 tms
600+ [(_, tms)] -> showNew (show n ++ "_rhs") 1 indent tms
599 let (nonblank, rest) = span (not . all isSpace) (tyline:later)
601 let (nonblank, rest) = span (not . all isSpace) (tyline:later)
600 if updatefile then
602 if updatefile then
601 do let fb = fn ++ "~"
603 do let fb = fn ++ "~"
@@ -616,12 +618,17 @@ process h fn (AddMissing updatefile l n)
616 getAppName (PRef _ r) = r
618 getAppName (PRef _ r) = r
617 getAppName _ = n
619 getAppName _ = n
619− showNew nm i (tm : tms)
621+ showNew nm i ind (tm : tms)
620 = do (nm', i') <- getUniq nm i
622 = do (nm', i') <- getUniq nm i
621− rest <- showNew nm i' tms
623+ rest <- showNew nm i' ind tms
624+ return (replicate ind ' ' ++
622− return (showPat tm ++ " = ?" ++ nm' ++
625+ showPat tm ++ " = ?" ++ nm' ++
623 "\n" ++ rest)
626 "\n" ++ rest)
624− showNew nm i [] = return ""
627+ showNew nm i _ [] = return ""
629+ getIndent i n [] = 0
630+ getIndent i n xs | take (length n) xs == n = i
631+ getIndent i n (x : xs) = getIndent (i + 1) n xs
626process h fn (MakeWith updatefile l n)
633process h fn (MakeWith updatefile l n)
627 = do src <- runIO $ readFile fn
634 = do src <- runIO $ readFile fn