1function M.append_output_cell(lines)
2 if not M.output_buf_valid() then return end
3
4 local buf = M.repl.output_buf
5 local prompt_content = M.get_last_line() or ""
6 -- Filter out echoed input (lines that match what we just sent)
7 local filtered = {}
8 for i, line in ipairs(lines) do
9 -- Skip lines that look like raw echoed input
10 if i == 1 and prompt_content:match("^i%d+ :") then
11 table.insert(filtered, prompt_content .. line)
12 else
13 table.insert(filtered, line)
14 end
15 end
16
17 if #filtered > 0 then
18 -- table.insert(filtered, "")