From 385beb4998615d03568f64040bef9761f5cdcbf2 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Fri, 20 Jul 2018 19:47:58 -0700 Subject: Slightly better newline handling for long text. Now won't force an indent for "\nhello" --- nomsu_compiler.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'nomsu_compiler.lua') diff --git a/nomsu_compiler.lua b/nomsu_compiler.lua index 2b68bd9..b51605b 100644 --- a/nomsu_compiler.lua +++ b/nomsu_compiler.lua @@ -1001,9 +1001,13 @@ do break end if tree.type == "Text" then - if (function() + local check_for_nl + check_for_nl = function(tree) local found_nl = false for i, b in ipairs(tree) do + if type(b) ~= 'string' and b.type == "Text" and check_for_nl(b) then + return true + end if i == 1 and type(b) == 'string' then b = b:match('^[\n]*(.*)') end @@ -1012,7 +1016,8 @@ do return true end end - end)() then + end + if check_for_nl(tree) then break end end -- cgit v1.2.3