Skip to content

Commit 026f09d

Browse files
committed
Fix builtin.registers.
Fix editing a letter register (A-Z) would always append to the register, fixed by editing a-z instead. Fix picker not updating after editing a register. builtin.registers: Fix editing of read-only registers
1 parent a4ed825 commit 026f09d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lua/telescope/actions/init.lua

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,21 +447,26 @@ actions.edit_register = function(prompt_bufnr)
447447
local selection = action_state.get_selected_entry()
448448
local picker = action_state.get_current_picker(prompt_bufnr)
449449

450+
if string.find("%:.", selection.value, 1, true) then
451+
-- %, : and . are read-only registers
452+
return false
453+
end
454+
450455
vim.fn.inputsave()
451456
local updated_value = vim.fn.input("Edit [" .. selection.value .. "] ❯ ", selection.content)
452457
vim.fn.inputrestore()
453458
if updated_value ~= selection.content then
454-
vim.fn.setreg(selection.value, updated_value)
459+
vim.fn.setreg(string.lower(selection.value), updated_value)
455460
selection.content = updated_value
456461
end
457462

458463
-- update entry in results table
459-
-- TODO: find way to redraw finder content
460464
for _, v in pairs(picker.finder.results) do
461465
if v == selection then
462466
v.content = updated_value
463467
end
464468
end
469+
picker:refresh()
465470
end
466471

467472
--- Paste the selected register into the buffer

0 commit comments

Comments
 (0)