Skip to content

Commit e065145

Browse files
authored
fix(builtin.keymaps): escape newline chars in desc (#2832)
closes #2827
1 parent aacaa9c commit e065145

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lua/telescope/make_entry.lua

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ function make_entry.gen_from_keymaps(opts)
835835
if entry.callback and not entry.desc then
836836
return require("telescope.actions.utils")._get_anon_function_name(debug.getinfo(entry.callback))
837837
end
838-
return vim.F.if_nil(entry.desc, entry.rhs)
838+
return vim.F.if_nil(entry.desc, entry.rhs):gsub("\n", "\\n")
839839
end
840840

841841
local function get_lhs(entry)
@@ -872,14 +872,15 @@ function make_entry.gen_from_keymaps(opts)
872872
end
873873

874874
return function(entry)
875+
local desc = get_desc(entry)
876+
local lhs = get_lhs(entry)
875877
return make_entry.set_default_entry_mt({
876878
mode = entry.mode,
877-
lhs = get_lhs(entry),
878-
desc = get_desc(entry),
879-
--
879+
lhs = lhs,
880+
desc = desc,
880881
valid = entry ~= "",
881882
value = entry,
882-
ordinal = entry.mode .. " " .. get_lhs(entry) .. " " .. get_desc(entry),
883+
ordinal = entry.mode .. " " .. lhs .. " " .. desc,
883884
display = make_display,
884885
}, opts)
885886
end

0 commit comments

Comments
 (0)