use tabs in msg files

This commit is contained in:
Alex Bates 2021-02-10 14:26:58 +00:00
parent b2d0b2c6c8
commit addfc799f6
3 changed files with 10 additions and 9 deletions

View File

@ -11,3 +11,6 @@ indent_size = 2
[{Makefile,*.mk}]
indent_style = tab
[*.msg]
indent_style = tab

View File

@ -388,7 +388,7 @@ if __name__ == "__main__":
explicit_end = False
while len(source) > 0:
if source[0] == "\r":
if source[0] == "\r" or source[0] == "\t":
source = source[1:]
continue
@ -397,7 +397,7 @@ if __name__ == "__main__":
source = source[1:]
for i in range(indent_level):
if source[0] == " " or source[0] == "\t":
if source[0] == "\t":
source = source[1:]
else:
break
@ -452,14 +452,12 @@ if __name__ == "__main__":
# count indent level
indent_level = 0
"""
while source[0] == " " or source[0] == "\t" or source[0] == "\n" or source[0] == "\r":
if source[0] == " " or source[0] == "\t":
indent_level += 1
source = source[1:]
# TODO: lookahead at all lines until "}" to determine lowest indent value
if indent_level == 4:
break
"""
else:
command, args, source = parse_command(source)

View File

@ -410,9 +410,9 @@ class N64SegPaperMarioMessages(N64Segment):
break
if msg_name is None:
self.f.write(f"#message:{i:02X}:{j:03X} {{\n ")
self.f.write(f"#message:{i:02X}:{j:03X} {{\n\t")
else:
self.f.write(f"#message:{i:02X}:({msg_name}) {{\n ")
self.f.write(f"#message:{i:02X}:({msg_name}) {{\n\t")
self.write_message_markup(data[msg_offset:])
self.f.write("\n}\n")
@ -470,7 +470,7 @@ class N64SegPaperMarioMessages(N64Segment):
self.write_markup("[end]")
def write_markup(self, markup):
self.f.write(re.sub("\n", "\n ", markup))
self.f.write(re.sub("\n", "\n\t", markup))
if markup == "[font:title]\n" or markup == "[font:subtitle]\n":
self.root_charset = CHARSET_CREDITS