@@ -111,7 +111,7 @@ addMissing :: FilePath -> Bool -> Int -> Name -> Idris ()
111111addMissing fn updatefile l n
112112 = do src <- runIO $ readSource fn
113113 let (before, tyline : later) = splitAt (l-1) (lines src)
114− let indent = getIndent 0 (show n) tyline
114+ let indent = getIndent tyline
115115 i <- getIState
116116 cl <- getInternalApp fn l
117117 let n' = getAppName cl
@@ -124,9 +124,9 @@ addMissing fn updatefile l n
124124 if updatefile
125125 then do let fb = fn ++ "~"
126126 runIO $ writeSource fb (unlines (before ++ nonblank)
127− ++ extras ++
128− (if null extras then ""
129− else "\n" ++ unlines rest))
127+ ++ extras
128+ ++ (if null extras then "" else "\n")
129+ ++ unlines rest)
130130 runIO $ copyFile fb fn
131131 else iPrintResult extras
132132 where showPat = show . stripNS
@@ -155,9 +155,7 @@ addMissing fn updatefile l n
155155 "\n" ++ rest))
156156 showNew nm i _ [] = return ""
157157
158− getIndent i n [] = 0
159− getIndent i n xs | take (length n) xs == n = i
160− getIndent i n (x : xs) = getIndent (i + 1) n xs
158+ getIndent s = length (takeWhile isSpace s)
161159
162160
163161makeWith :: FilePath -> Bool -> Int -> Name -> Idris ()