Skip to content

Commit

Permalink
fix(builtin.keymaps): escape newline chars in desc (#2832)
Browse files Browse the repository at this point in the history
closes #2827
  • Loading branch information
jamestrew authored Dec 27, 2023
1 parent aacaa9c commit e065145
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lua/telescope/make_entry.lua
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ function make_entry.gen_from_keymaps(opts)
if entry.callback and not entry.desc then
return require("telescope.actions.utils")._get_anon_function_name(debug.getinfo(entry.callback))
end
return vim.F.if_nil(entry.desc, entry.rhs)
return vim.F.if_nil(entry.desc, entry.rhs):gsub("\n", "\\n")
end

local function get_lhs(entry)
Expand Down Expand Up @@ -872,14 +872,15 @@ function make_entry.gen_from_keymaps(opts)
end

return function(entry)
local desc = get_desc(entry)
local lhs = get_lhs(entry)
return make_entry.set_default_entry_mt({
mode = entry.mode,
lhs = get_lhs(entry),
desc = get_desc(entry),
--
lhs = lhs,
desc = desc,
valid = entry ~= "",
value = entry,
ordinal = entry.mode .. " " .. get_lhs(entry) .. " " .. get_desc(entry),
ordinal = entry.mode .. " " .. lhs .. " " .. desc,
display = make_display,
}, opts)
end
Expand Down

0 comments on commit e065145

Please sign in to comment.