| 1 |
-- Copyright (c) 2020-2021 shadmansaleh |
| 2 |
-- MIT license, see LICENSE for more details. |
| 3 |
local M = require('lualine.component'):extend() |
| 4 |
|
| 5 |
M.update_status = function(self, is_focused) |
| 6 |
-- 1st element in options table is the function provided by config |
| 7 |
local ok, retval |
| 8 |
ok, retval = pcall(self.options[1], self, is_focused) |
| 9 |
if not ok then |
| 10 |
return '' |
| 11 |
end |
| 12 |
if type(retval) ~= 'string' then |
| 13 |
ok, retval = pcall(tostring, retval) |
| 14 |
if not ok then |
| 15 |
return '' |
| 16 |
end |
| 17 |
end |
| 18 |
return retval |
| 19 |
end |
| 20 |
|
| 21 |
return M |