Skip to content

Commit 8bc7b7e

Browse files
committed
fix type error
1 parent 04a8f29 commit 8bc7b7e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lua/convert/converters.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ converters['in'] = {
177177
}
178178

179179
local function hex_to_rgb(val)
180-
local hex = val:gsub("#", "")
180+
local str = tostring(val)
181+
local hex = str:gsub("#", "")
181182

182183
if #hex == 3 then
183184
local r = tonumber(hex:sub(1, 1) .. hex:sub(1, 1), 16)

lua/convert/ui/open_popup.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ M.open_win = function(found_units)
105105
for i = #found_units, 1, -1 do
106106
local match = found_units[i]
107107
if match.unit == from_unit then
108-
local converted = calculator.convert(from_unit, to_unit, match.val)
108+
local converted = calculator.convert(from_unit, to_unit, tonumber(match.val))
109109
vim.api.nvim_buf_set_text(
110110
bufnr,
111111
match.pos.row - 1,

0 commit comments

Comments
 (0)