diff options
author | rxi <rxi@users.noreply.github.com> | 2020-04-30 13:33:09 +0100 |
---|---|---|
committer | rxi <rxi@users.noreply.github.com> | 2020-04-30 13:36:03 +0100 |
commit | 6dd61f0c9cc3ee6c4da25f564db36b3458a90532 (patch) | |
tree | c414300e3fe9869e5b21ae85635f11302a76ec84 /plugins | |
parent | 00008754892d8ece014fda5abce905eae64ae331 (diff) | |
download | lite-xl-plugins-6dd61f0c9cc3ee6c4da25f564db36b3458a90532.tar.gz lite-xl-plugins-6dd61f0c9cc3ee6c4da25f564db36b3458a90532.zip |
Changed selectionhighlight plugin to draw box instead of filled rectangle
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/selectionhighlight.lua | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/plugins/selectionhighlight.lua b/plugins/selectionhighlight.lua index 31a5042..5404ce7 100644 --- a/plugins/selectionhighlight.lua +++ b/plugins/selectionhighlight.lua @@ -3,6 +3,16 @@ local DocView = require "core.docview" -- originally written by luveti +local function draw_box(x, y, w, h, color) + local r = renderer.draw_rect + local s = math.ceil(SCALE) + r(x, y, w, s, color) + r(x, y + h - s, w, s, color) + r(x, y + s, s, h - s * 2, color) + r(x + w - s, y + s, s, h - s * 2, color) +end + + local draw_line_body = DocView.draw_line_body function DocView:draw_line_body(idx, x, y) @@ -17,7 +27,8 @@ function DocView:draw_line_body(idx, x, y) if start_col == nil then break end local x1 = x + self:get_col_x_offset(idx, start_col) local x2 = x + self:get_col_x_offset(idx, end_col + 1) - renderer.draw_rect(x1, y, x2 - x1, lh, style.selection) + local color = style.selectionhighlight or style.syntax.comment + draw_box(x1, y, x2 - x1, lh, color) last_col = end_col + 1 end end |