@@ -10,6 +10,16 @@ local append = require('opencode.ui.renderer.append')
1010local M = {}
1111local warned_part_render_error = false
1212
13+ local pinned_overlay_part_ids = {
14+ [' permission-display-part' ] = true ,
15+ [' question-display-part' ] = true ,
16+ }
17+
18+ local pinned_overlay_message_ids = {
19+ [' permission-display-message' ] = true ,
20+ [' question-display-message' ] = true ,
21+ }
22+
1323--- @param part_id string
1424--- @param message_id string | nil
1525--- @param err any
@@ -401,7 +411,39 @@ local function apply_pending(pending)
401411 return false
402412 end
403413
404- local scroll_snapshot = scroll .pre_flush (buf )
414+ local only_pinned_overlay_updates = true
415+ for _ , part_id in ipairs (pending .removed_part_order ) do
416+ if pending .removed_parts [part_id ] and not pinned_overlay_part_ids [part_id ] then
417+ only_pinned_overlay_updates = false
418+ break
419+ end
420+ end
421+ if only_pinned_overlay_updates then
422+ for _ , message_id in ipairs (pending .removed_message_order ) do
423+ if pending .removed_messages [message_id ] and not pinned_overlay_message_ids [message_id ] then
424+ only_pinned_overlay_updates = false
425+ break
426+ end
427+ end
428+ end
429+ if only_pinned_overlay_updates then
430+ for _ , message_id in ipairs (pending .dirty_message_order ) do
431+ if pending .dirty_messages [message_id ] and not pinned_overlay_message_ids [message_id ] then
432+ only_pinned_overlay_updates = false
433+ break
434+ end
435+ end
436+ end
437+ if only_pinned_overlay_updates then
438+ for _ , part_id in ipairs (pending .dirty_part_order ) do
439+ if pending .dirty_parts [part_id ] and not pinned_overlay_part_ids [part_id ] then
440+ only_pinned_overlay_updates = false
441+ break
442+ end
443+ end
444+ end
445+
446+ local scroll_snapshot = only_pinned_overlay_updates and nil or scroll .pre_flush (buf )
405447 with_suppressed_output_autocmds (function ()
406448 for _ , part_id in ipairs (pending .removed_part_order ) do
407449 if pending .removed_parts [part_id ] then
0 commit comments