From 5dd63f3ffc4244375cecaa2edc58f8f1514f77d4 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Mon, 4 Jul 2022 10:58:54 +0200 Subject: Have to work --- init.lua | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/init.lua b/init.lua index 3725520..25486c0 100644 --- a/init.lua +++ b/init.lua @@ -135,16 +135,19 @@ vis:operator_new( local non_spc_idx = line:len() >= beg_spc_len + 1 and beg_spc_len + 1 or 0 print("non_spc_idx = " .. non_spc_idx) - if non_spc_idx ~= 0 then -- FIXME This is wrong, no two cycles - if p_arg == 0 then - p_arg = "p" .. hanging_symbol(line, non_spc_idx) - end + -- FIXME This is wrong, consider multi item list + if p_arg == 0 then + p_arg = "p" .. hanging_symbol(line, non_spc_idx) + end + + if non_spc_idx ~= 0 then + print("line = " .. line) print("segment = " .. dump(segment) .. ", p_arg = " .. p_arg) table.insert(segment, line) else -- this is an empty line, so do whole circus FIXME if next(segment) then local new_text = run_shell_cmd(par_prg, ex_args .. p_arg, - table.concat(segment, "\n")) + table.concat(segment, "\n")) segment = {} p_arg = 0 out = out .. new_text -- cgit