Skip to content

Commit

Permalink
change: passed window ID to 'get_text' and 'get_width' functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
obaland committed Jun 4, 2023
1 parent bb55ffe commit a19ae13
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions lua/vfiler/columns/devicons.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,7 @@ DeviconsColumn.configs = {
-- end
--end

local icon_width = 1
local ICON_WIDTH = 1

local function get_syntax(name, icon)
-- syntax
Expand Down Expand Up @@ -1118,21 +1118,25 @@ function DeviconsColumn.new()
return core.inherit(DeviconsColumn, Column, syntaxes)
end

function DeviconsColumn:get_width(items, width)
return icon_width
end

function DeviconsColumn:get_text(item, width)
local key
function DeviconsColumn:to_text(item, width)
local syntax
if item.selected then
key = 'Selected'
syntax = 'Selected'
elseif item.type == 'directory' then
key = item.opened and 'OpenedDirectory' or 'ClosedDirectory'
syntax = item.opened and 'OpenedDirectory' or 'ClosedDirectory'
else
key = get_file_key(item.name)
syntax = get_file_key(item.name)
end
local i = DeviconsColumn.configs.icons[key]
return self:surround_text(key, i.icon), icon_width
local i = DeviconsColumn.configs.icons[syntax]
return {
string = i.icon,
width = ICON_WIDTH,
syntax = syntax
}
end

function DeviconsColumn:get_width(items, width, winid)
return ICON_WIDTH
end

return DeviconsColumn

0 comments on commit a19ae13

Please sign in to comment.