From e0b0e0cf1e11195063b305e505fd50a0a02efb29 Mon Sep 17 00:00:00 2001 From: Akianonymus Date: Sat, 27 Aug 2022 20:31:45 +0530 Subject: fix: error when invalid hsl/rgb values more like a type fix --- lua/colorizer.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lua/colorizer.lua') diff --git a/lua/colorizer.lua b/lua/colorizer.lua index e14db85..6ecf8d1 100644 --- a/lua/colorizer.lua +++ b/lua/colorizer.lua @@ -339,7 +339,7 @@ do end local h, s, l, match_end = line:sub(i):match "^hsl%(%s*(%d+)%s*,%s*(%d+)%%%s*,%s*(%d+)%%%s*%)()" if not match_end then - local h, s, l, match_end = line:sub(i):match "^hsl%(%s*(%d+)%s+(%d+)%%%s+(%d+)%%%s*%)()" + h, s, l, match_end = line:sub(i):match "^hsl%(%s*(%d+)%s+(%d+)%%%s+(%d+)%%%s*%)()" if not match_end then return end @@ -371,7 +371,7 @@ do local r, g, b, a, match_end = line:sub(i):match "^rgba%(%s*(%d+%%?)%s*,%s*(%d+%%?)%s*,%s*(%d+%%?)%s*,%s*([.%d]+)%s*%)()" if not match_end then - local r, g, b, a, match_end = line:sub(i):match "^rgba%(%s*(%d+%%?)%s+(%d+%%?)%s+(%d+%%?)%s+([.%d]+)%s*%)()" + r, g, b, a, match_end = line:sub(i):match "^rgba%(%s*(%d+%%?)%s+(%d+%%?)%s+(%d+%%?)%s+([.%d]+)%s*%)()" if not match_end then return end @@ -402,7 +402,7 @@ do end local h, s, l, a, match_end = line:sub(i):match "^hsla%(%s*(%d+)%s*,%s*(%d+)%%%s*,%s*(%d+)%%%s*,%s*([.%d]+)%s*%)()" if not match_end then - local h, s, l, a, match_end = line:sub(i):match "^hsla%(%s*(%d+)%s+(%d+)%%%s+(%d+)%%%s+([.%d]+)%s*%)()" + h, s, l, a, match_end = line:sub(i):match "^hsla%(%s*(%d+)%s+(%d+)%%%s+(%d+)%%%s+([.%d]+)%s*%)()" if not match_end then return end @@ -431,6 +431,7 @@ do return match_end - 1, rgb_hex end end + local css_function_parser, rgb_function_parser, hsl_function_parser do local CSS_FUNCTION_TRIE = Trie { "rgb", "rgba", "hsl", "hsla" } -- cgit v1.2.3-70-g09d2