make more tests green

This commit is contained in:
Andreas Rumpf 2018-04-30 02:52:58 +02:00
commit 0fad659bf7
9 changed files with 36 additions and 33 deletions

View file

@ -1126,7 +1126,7 @@ proc unindent*(s: string, count: Natural, padding: string = " "): string
var indentCount = 0
for j in 0..<count.int:
indentCount.inc
if line[j .. j + padding.len-1] != padding:
if j + padding.len-1 >= line.len or line[j .. j + padding.len-1] != padding:
indentCount = j
break
result.add(line[indentCount*padding.len .. ^1])