Skip to content

Commit 05dd0ff

Browse files
committed
refactor(streaming_renderer): don't need msg cache
1 parent 462af6d commit 05dd0ff

File tree

1 file changed

+1
-23
lines changed

1 file changed

+1
-23
lines changed

lua/opencode/ui/streaming_renderer.lua

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@ local M = {}
44

55
M._subscriptions = {}
66
M._part_cache = {}
7-
M._message_cache = {}
87
M._namespace = vim.api.nvim_create_namespace('opencode_stream')
98
M._prev_line_count = 0
109

1110
function M.reset()
1211
M._part_cache = {}
13-
M._message_cache = {}
1412
M._prev_line_count = 0
1513

1614
-- FIXME: this prolly isn't the right place for state.messages to be
@@ -87,15 +85,6 @@ function M._shift_lines(from_line, delta)
8785
end
8886
end
8987
end
90-
91-
for msg_id, msg_data in pairs(M._message_cache) do
92-
if msg_data.line_start and msg_data.line_start >= from_line then
93-
msg_data.line_start = msg_data.line_start + delta
94-
if msg_data.line_end then
95-
msg_data.line_end = msg_data.line_end + delta
96-
end
97-
end
98-
end
9988
end
10089

10190
function M._apply_extmarks(buf, line_offset, extmarks)
@@ -304,14 +293,7 @@ function M.on_message_updated(event)
304293
table.insert(state.messages, { info = message, parts = {} })
305294
found_idx = #state.messages
306295

307-
local header_range = M._write_message_header(message, found_idx)
308-
if header_range then
309-
if not M._message_cache[message.id] then
310-
M._message_cache[message.id] = {}
311-
end
312-
M._message_cache[message.id].line_start = header_range.line_start
313-
M._message_cache[message.id].line_end = header_range.line_end
314-
end
296+
M._write_message_header(message, found_idx)
315297
end
316298

317299
M._scroll_to_bottom()
@@ -475,10 +457,6 @@ function M.on_message_removed(event)
475457
end
476458

477459
table.remove(state.messages, message_idx)
478-
479-
if M._message_cache[message_id] then
480-
M._message_cache[message_id] = nil
481-
end
482460
end
483461

484462
function M.on_session_compacted()

0 commit comments

Comments
 (0)