nimpretty: fixes #8078

This commit is contained in:
Araq
2018-10-24 00:59:57 +02:00
parent e3a0415650
commit 3ee53a7c8e
3 changed files with 17 additions and 1 deletions

View File

@@ -1148,7 +1148,7 @@ proc skip(L: var TLexer, tok: var TToken) =
break
tok.strongSpaceA = 0
when defined(nimpretty):
if buf[pos] == '#': commentIndent = indent
if buf[pos] == '#' and tok.line < 0: commentIndent = indent
if buf[pos] > ' ' and (buf[pos] != '#' or buf[pos+1] == '#'):
tok.indent = indent
L.currLineIndent = indent

View File

@@ -3,3 +3,11 @@ var x: int = 2
echo x
# bug #9144
proc a() =
while true:
discard
# comment 1
# comment 2
discard

View File

@@ -3,3 +3,11 @@ var x: int = 2
echo x
# bug #9144
proc a() =
while true:
discard
# comment 1
# comment 2
discard