From 2488e31df8ff13cb3c008f846a137bf39287f048 Mon Sep 17 00:00:00 2001 From: Simon Hauser Date: Sat, 19 Dec 2020 21:13:05 +0100 Subject: Feat: displayer hl_chars and TelescopeResults hlgroups (#349) --- lua/telescope/pickers/entry_display.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'lua/telescope/pickers/entry_display.lua') diff --git a/lua/telescope/pickers/entry_display.lua b/lua/telescope/pickers/entry_display.lua index 4edd0ae..c7a51ac 100644 --- a/lua/telescope/pickers/entry_display.lua +++ b/lua/telescope/pickers/entry_display.lua @@ -62,8 +62,18 @@ entry_display.create = function(configuration) table.insert(highlights, { { hl_start, hl_end }, configuration.separator_hl }) end end + local final_str = table.concat(results, configuration.separator or "│") + if configuration.hl_chars then + for i = 1, #final_str do + local c = final_str:sub(i,i) + local hl = configuration.hl_chars[c] + if hl then + table.insert(highlights, { { i - 1, i }, hl }) + end + end + end - return table.concat(results, configuration.separator or "│"), highlights + return final_str, highlights end end -- cgit v1.2.3