diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-07-17 15:00:57 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-07-17 15:01:04 -0700 |
| commit | 39a0121856f8230332bcef1b6a7108696f2a765d (patch) | |
| tree | 5773a088243f02be20a963c676fde6d52ec5fcd3 /code_obj.lua | |
| parent | 0442c8dd216f16c7371873a8e8fd8bf83d30dad0 (diff) | |
Improvements to nomsu codegen.
Diffstat (limited to 'code_obj.lua')
| -rw-r--r-- | code_obj.lua | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/code_obj.lua b/code_obj.lua index a861bf2..0fcd34d 100644 --- a/code_obj.lua +++ b/code_obj.lua @@ -103,9 +103,18 @@ do if trailing_text then self.current_indent = #spaces self.trailing_line_len = #trailing_text + else + self.trailing_line_len = self.trailing_line_len + #b end else - self.trailing_line_len = math.min(self.trailing_line_len + #tostring(b), b.trailing_line_len) + do + local trailing_text = match(tostring(b), "\n([^\n]*)$") + if trailing_text then + self.trailing_line_len = #trailing_text + self.current_indent + else + self.trailing_line_len = self.trailing_line_len + #tostring(b) + end + end if self.current_indent ~= 0 then indents[#bits] = self.current_indent end |
