diff options
| author | Simon Hauser <Simon-Hauser@outlook.de> | 2020-12-19 21:13:05 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-19 21:13:05 +0100 |
| commit | 2488e31df8ff13cb3c008f846a137bf39287f048 (patch) | |
| tree | 8a936ba14175dd5f979387fae01697bbfc627c98 /lua/telescope/pickers/entry_display.lua | |
| parent | 084a30b8fa40278e1dce8ee304a1a793c530ee3f (diff) | |
Feat: displayer hl_chars and TelescopeResults hlgroups (#349)
Diffstat (limited to 'lua/telescope/pickers/entry_display.lua')
| -rw-r--r-- | lua/telescope/pickers/entry_display.lua | 12 |
1 files changed, 11 insertions, 1 deletions
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 |
