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

(cherry picked from commit e065145)
  • Loading branch information
jamestrew authored and Conni2461 committed Mar 6, 2024
1 parent abd9a6f commit 42bbf5a
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 @@ -828,7 +828,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 All @@ -852,14 +852,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 42bbf5a

Please sign in to comment.