Skip to content

Commit

Permalink
Fix: Buffer is not 'modifiable' (#1677)
Browse files Browse the repository at this point in the history
  • Loading branch information
GyouzaRu authored Dec 10, 2023
1 parent 55734c8 commit 5e1fa02
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions lua/cmp/view/custom_entries_view.lua
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,13 @@ custom_entries_view.open = function(self, offset, entries)
end
end
end
vim.api.nvim_buf_set_lines(entries_buf, 0, -1, false, lines)
if vim.bo[entries_buf].modifiable == false then
vim.bo[entries_buf].modifiable = true
vim.api.nvim_buf_set_lines(entries_buf, 0, -1, false, lines)
vim.bo[entries_buf].modifiable = false
else
vim.api.nvim_buf_set_lines(entries_buf, 0, -1, false, lines)
end
vim.api.nvim_buf_set_option(entries_buf, 'modified', false)

local width = 0
Expand Down Expand Up @@ -264,7 +270,13 @@ custom_entries_view.draw = function(self)
table.insert(texts, table.concat(text, ''))
end
end
vim.api.nvim_buf_set_lines(entries_buf, topline, botline, false, texts)
if vim.bo[entries_buf].modifiable == false then
vim.bo[entries_buf].modifiable = true
vim.api.nvim_buf_set_lines(entries_buf, topline, botline, false, texts)
vim.bo[entries_buf].modifiable = false
else
vim.api.nvim_buf_set_lines(entries_buf, topline, botline, false, texts)
end
vim.api.nvim_buf_set_option(entries_buf, 'modified', false)

if api.is_cmdline_mode() then
Expand Down

0 comments on commit 5e1fa02

Please sign in to comment.