@@ -109,7 +109,7 @@ function M._render_full_session_data(session_data)
109109 local revert_stats = M ._calculate_revert_stats (state .messages , i , state .active_session .revert )
110110 local output = require (' opencode.ui.output' ):new ()
111111 formatter ._format_revert_message (output , revert_stats )
112- M .write_output (output )
112+ M .render_output (output )
113113
114114 -- FIXME: how does reverting work? why is it breaking out of the message reading loop?
115115 break
@@ -188,9 +188,17 @@ function M._shift_parts_and_actions(from_line, delta)
188188 -- vim.notify('Shifting lines from: ' .. from_line .. ' by delta: ' .. delta .. ' examined: ' .. examined .. ' shifted: ' .. shifted)
189189end
190190
191+ --- Render lines as the entire output buffer
192+ --- @param lines any
193+ function M .render_lines (lines )
194+ local output = require (' opencode.ui.output' ):new ()
195+ output .lines = lines
196+ M .render_output (output )
197+ end
198+
191199--- Sets the entire output buffer based on output_data
192200--- @param output_data Output Output object from formatter
193- function M .write_output (output_data )
201+ function M .render_output (output_data )
194202 if not output_window .mounted () then
195203 return
196204 end
@@ -267,17 +275,6 @@ function M._write_formatted_data(formatted_data)
267275 }
268276end
269277
270- --- Write message header to buffer
271- --- @param message OpencodeMessage Message object
272- --- @param msg_idx integer Message index
273- --- @return { line_start : integer , line_end : integer }? Range where header was written
274- function M ._write_message_header (message , msg_idx )
275- state .current_message = message
276- local header_data = formatter .format_message_header_single (message , msg_idx )
277- local line_range = M ._write_formatted_data (header_data )
278- return line_range
279- end
280-
281278--- Insert new part at end of buffer
282279--- @param part_id string Part ID
283280--- @param formatted_data Output Formatted data as Output object
0 commit comments