nimgrep: fixes #989

This commit is contained in:
Araq
2019-01-13 16:22:19 +01:00
parent 2ccc9db59d
commit bd5dd2b95b

View File

@@ -160,7 +160,7 @@ proc processFile(pattern; filename: string; counter: var int) =
var reallyReplace = true
while i < buffer.len:
let t = findBounds(buffer, pattern, matches, i)
if t.first < 0: break
if t.first < 0 or t.last < t.first: break
inc(line, countLines(buffer, i, t.first-1))
var wholeMatch = buffer.substr(t.first, t.last)