nimpretty: fixes #8078

(cherry picked from commit 3ee53a7c8e)
This commit is contained in:
Araq
2018-10-24 00:59:57 +02:00
committed by narimiran
parent 8196fd6f73
commit db68353848
3 changed files with 17 additions and 1 deletions

View File

@@ -1100,7 +1100,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