Skip to content

Commit e6931e0

Browse files
committed
fix: don't update suggestion buffer if the text doesn't change
This prevents the folding in the suggestion buffer to get off when the suggestion doesn't actually modify the original and the user types some text outside of the tripple-quoted suggestion segment.
1 parent 3dec6ee commit e6931e0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lua/gitlab/actions/suggestions.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,12 @@ local create_autocommands = function(
527527
local suggestion = List.new(suggestions):find(function(sug)
528528
return current_line <= sug.note_end_linenr
529529
end)
530-
if not suggestion or suggestion == last_suggestion then
530+
local old_buffer_text = u.get_buffer_text(suggestion_buf)
531+
if
532+
not suggestion
533+
or suggestion == last_suggestion
534+
or old_buffer_text == table.concat(suggestion.full_text, "\n")
535+
then
531536
return
532537
end
533538
set_buffer_lines(suggestion_buf, suggestion.full_text, imply_local)

0 commit comments

Comments
 (0)