diff options
| author | Simon Hauser <Simon-Hauser@outlook.de> | 2020-11-16 21:17:13 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-16 15:17:13 -0500 |
| commit | eaa7011f8499f2c8c473a5beb50100f1cae006cf (patch) | |
| tree | 6b004689f95f0cf93b476428f3543a29a3483559 /lua/telescope/pickers/entry_display.lua | |
| parent | 81172630270325947d2c6b3afda5599e34b48499 (diff) | |
feat: Add tags (#219)
Diffstat (limited to 'lua/telescope/pickers/entry_display.lua')
| -rw-r--r-- | lua/telescope/pickers/entry_display.lua | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lua/telescope/pickers/entry_display.lua b/lua/telescope/pickers/entry_display.lua index c661b89..aef3047 100644 --- a/lua/telescope/pickers/entry_display.lua +++ b/lua/telescope/pickers/entry_display.lua @@ -43,8 +43,8 @@ end local function truncate(str, len) -- TODO: This doesn't handle multi byte chars... - if vim.fn.strdisplaywidth(str) > len - 1 then - str = str:sub(1, len) + if vim.fn.strdisplaywidth(str) > len then + str = str:sub(1, len - 1) str = str .. "…" end return str @@ -68,8 +68,10 @@ entry_display.create = function(configuration) return function(self, picker) local results = {} - for k, v in ipairs(self) do - table.insert(results, generator[k](v, picker)) + for i = 1, table.getn(generator) do + if self[i] ~= nil then + table.insert(results, generator[i](self[i], picker)) + end end return table.concat(results, configuration.separator or "│") |
