aboutsummaryrefslogtreecommitdiff
path: root/code_obj.lua
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-07-17 15:00:57 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-07-17 15:01:04 -0700
commit39a0121856f8230332bcef1b6a7108696f2a765d (patch)
tree5773a088243f02be20a963c676fde6d52ec5fcd3 /code_obj.lua
parent0442c8dd216f16c7371873a8e8fd8bf83d30dad0 (diff)
Improvements to nomsu codegen.
Diffstat (limited to 'code_obj.lua')
-rw-r--r--code_obj.lua11
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