diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2019-03-27 14:40:48 -0700 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2019-03-27 14:41:31 -0700 |
| commit | 8719641ace1228a9b650c27b8a575cb3d3c4c761 (patch) | |
| tree | c0aaca70a58b67ae93b6aae32c01dcae0c05befc /nomsu_decompiler.lua | |
| parent | f4dd9664bf4e2a19e0aeee20117107b22bae4cd4 (diff) | |
Added extra newline to output after a multiply-indented region ends.
Diffstat (limited to 'nomsu_decompiler.lua')
| -rw-r--r-- | nomsu_decompiler.lua | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/nomsu_decompiler.lua b/nomsu_decompiler.lua index c82bd39..cd35019 100644 --- a/nomsu_decompiler.lua +++ b/nomsu_decompiler.lua @@ -515,7 +515,7 @@ tree_to_nomsu = function(tree) nomsu:add("\n") if tree[i - 1].type ~= "Comment" then needs_space[i] = (line_nomsu:is_multiline() and prev_line:is_multiline()) - if tree[i].type == "Comment" or needs_space[i] or needs_space[i - 1] then + if (tree[i].type == "Comment" or needs_space[i] or needs_space[i - 1] or prev_line:text():match("\n [^\n]*$")) then nomsu:add("\n") end end @@ -654,9 +654,9 @@ tree_to_nomsu = function(tree) end nomsu:add(sep) if sep == '\n' then - if tree[i - 1].type ~= "Comment" then + if i > 1 and tree[i - 1].type ~= "Comment" then needs_space[i] = (item_nomsu:is_multiline() and prev_item:is_multiline()) - if tree[i].type == "Comment" or needs_space[i] or needs_space[i - 1] then + if (tree[i].type == "Comment" or needs_space[i] or needs_space[i - 1] or prev_item:text():match("\n [^\n]*$")) then nomsu:add("\n") end end |
