From eaa7011f8499f2c8c473a5beb50100f1cae006cf Mon Sep 17 00:00:00 2001 From: Simon Hauser Date: Mon, 16 Nov 2020 21:17:13 +0100 Subject: feat: Add tags (#219) --- lua/telescope/pickers/entry_display.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (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 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 "│") -- cgit v1.2.3