summary refs log tree commit diff stats
path: root/compiler/layouter.nim
diff options
context:
space:
mode:
authorMiran <narimiran@disroot.org>2019-07-02 10:52:46 +0200
committerAndreas Rumpf <rumpf_a@web.de>2019-07-02 10:52:46 +0200
commitc522a455df3817d98c2cd9132668c4eb9fbb0d88 (patch)
treedf69e37ab6c9300ef01cbba4271d21974a55188e /compiler/layouter.nim
parentcce8a739da1b74f8d85785524a9b4865afcda3e2 (diff)
downloadNim-c522a455df3817d98c2cd9132668c4eb9fbb0d88.tar.gz
[bugfix] nimpretty indents multiline comments correctly (#11607)
Diffstat (limited to 'compiler/layouter.nim')
-rw-r--r--compiler/layouter.nim4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/layouter.nim b/compiler/layouter.nim
index 546d4766e..e45e6400a 100644
--- a/compiler/layouter.nim
+++ b/compiler/layouter.nim
@@ -145,6 +145,10 @@ proc closeEmitter*(em: var Emitter) =
       maxLhs = 0
       lineBegin = i+1
     of ltTab:
+      if i >= 2 and em.kinds[i-2] == ltNewline and em.kinds[i-1] in {ltNewline, ltSpaces}:
+        # a previous section has ended
+        maxLhs = 0
+
       if maxLhs == 0:
         content.add em.tokens[i]
         inc lineLen, em.tokens[i].len