aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjgmdev <jgmdev@gmail.com>2022-05-22 22:08:32 -0400
committerjgmdev <jgmdev@gmail.com>2022-05-22 22:08:32 -0400
commitb51e0d5fbc500e28ef6f478d696561dc9f9507d8 (patch)
treed8ea3eca854e8a006730ce9a32082630b94ac94e
parentc8b60b093749e45bd3ed058203bd74d87ea65327 (diff)
downloadlite-xl-plugins-b51e0d5fbc500e28ef6f478d696561dc9f9507d8.tar.gz
lite-xl-plugins-b51e0d5fbc500e28ef6f478d696561dc9f9507d8.zip
colorpreview: renamed idx to line
-rw-r--r--plugins/colorpreview.lua20
1 files changed, 10 insertions, 10 deletions
diff --git a/plugins/colorpreview.lua b/plugins/colorpreview.lua
index d255639..f1e88d5 100644
--- a/plugins/colorpreview.lua
+++ b/plugins/colorpreview.lua
@@ -8,8 +8,8 @@ local black = { common.color "#000000" }
local tmp = {}
-local function draw_color_previews(self, idx, x, y, ptn, base, nibbles)
- local text = self.doc.lines[idx]
+local function draw_color_previews(self, line, x, y, ptn, base, nibbles)
+ local text = self.doc.lines[line]
local s, e = 0, 0
while true do
@@ -35,8 +35,8 @@ local function draw_color_previews(self, idx, x, y, ptn, base, nibbles)
b = b * 16
end
- local x1 = x + self:get_col_x_offset(idx, s)
- local x2 = x + self:get_col_x_offset(idx, e + 1)
+ local x1 = x + self:get_col_x_offset(line, s)
+ local x2 = x + self:get_col_x_offset(line, e + 1)
local oy = self:get_line_text_y_offset()
local text_color = math.max(r, g, b) < 128 and white or black
@@ -44,7 +44,7 @@ local function draw_color_previews(self, idx, x, y, ptn, base, nibbles)
local l1, _, l2, _ = self.doc:get_selection(true)
- if not (self.doc:has_selection() and idx >= l1 and idx <= l2) then
+ if not (self.doc:has_selection() and line >= l1 and line <= l2) then
renderer.draw_rect(x1, y, x2 - x1, self:get_line_height(), tmp)
renderer.draw_text(self:get_font(), str, x1, y + oy, text_color)
end
@@ -54,10 +54,10 @@ end
local draw_line_text = DocView.draw_line_text
-function DocView:draw_line_text(idx, x, y)
- local lh = draw_line_text(self, idx, x, y)
- draw_color_previews(self, idx, x, y, "#(%x%x)(%x%x)(%x%x)(%x?%x?)%f[%W]", 16)
- draw_color_previews(self, idx, x, y, "#(%x)(%x)(%x)%f[%W]", 16, true) -- support #fff css format
- draw_color_previews(self, idx, x, y, "rgba?%((%d+)%D+(%d+)%D+(%d+)[%s,]-([%.%d]-)%s-%)", nil)
+function DocView:draw_line_text(line, x, y)
+ local lh = draw_line_text(self, line, x, y)
+ draw_color_previews(self, line, x, y, "#(%x%x)(%x%x)(%x%x)(%x?%x?)%f[%W]", 16)
+ draw_color_previews(self, line, x, y, "#(%x)(%x)(%x)%f[%W]", 16, true) -- support #fff css format
+ draw_color_previews(self, line, x, y, "rgba?%((%d+)%D+(%d+)%D+(%d+)[%s,]-([%.%d]-)%s-%)", nil)
return lh
end