From 2ae077973e523d2456555ddf5342c1e3185d65da Mon Sep 17 00:00:00 2001 From: akianonymus Date: Sun, 26 Feb 2023 16:45:06 +0530 Subject: fix: hsl: for multiple spaces in between --- lua/colorizer/utils.lua | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lua/colorizer/utils.lua') diff --git a/lua/colorizer/utils.lua b/lua/colorizer/utils.lua index 282e405..724b46e 100644 --- a/lua/colorizer/utils.lua +++ b/lua/colorizer/utils.lua @@ -71,6 +71,14 @@ function utils.byte_is_valid_colorchar(byte) return utils.byte_is_alphanumeric(byte) or byte == ("-"):byte() end +---Count the number of character in a string +---@param str string +---@param pattern string +---@return number +function utils.count(str, pattern) + return select(2, string.gsub(str, pattern, "")) +end + --- Get last modified time of a file ---@param path string: file path ---@return number|nil: modified time -- cgit v1.2.3-70-g09d2