From cb4b7efd3effdf2d315b95828284223c9aa06769 Mon Sep 17 00:00:00 2001 From: Daniel Gavin Date: Wed, 14 Apr 2021 01:57:42 +0200 Subject: [PATCH] only align comments in same indentation blocks --- core/odin/printer/printer.odin | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/odin/printer/printer.odin b/core/odin/printer/printer.odin index 55a67ca70..dc4cb1c1a 100644 --- a/core/odin/printer/printer.odin +++ b/core/odin/printer/printer.odin @@ -186,6 +186,7 @@ align_comments :: proc(p: ^Printer) { length: int, begin: int, end: int, + depth: int, }; comment_infos := make([dynamic]Comment_Align_Info, 0, context.temp_allocator); @@ -200,7 +201,7 @@ align_comments :: proc(p: ^Printer) { if .Line_Comment in line.types { - if current_info.end + 1 != line_index { + if current_info.end + 1 != line_index || current_info.depth != line.depth { if (current_info.begin != 0 && current_info.end != 0) || current_info.length > 0 { append(&comment_infos, current_info); @@ -208,6 +209,7 @@ align_comments :: proc(p: ^Printer) { current_info.begin = line_index; current_info.end = line_index; + current_info.depth = line.depth; current_info.length = 0; }