aboutsummaryrefslogtreecommitdiff
path: root/plugins/spellcheck.lua
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2022-04-16 14:52:36 -0400
committerjgmdev <jgmdev@gmail.com>2022-05-22 13:20:25 -0400
commit2cab9ec9e0746f2ff3c41207e101c79db6d58ab2 (patch)
tree2b549575b56c0d43c0922701774911b23ec6147c /plugins/spellcheck.lua
parent879ca7690a5614480ea236eeb707f940e7f46500 (diff)
downloadlite-xl-plugins-2cab9ec9e0746f2ff3c41207e101c79db6d58ab2.tar.gz
lite-xl-plugins-2cab9ec9e0746f2ff3c41207e101c79db6d58ab2.zip
Updated spellcheck to work with linewrapping.
Diffstat (limited to 'plugins/spellcheck.lua')
-rw-r--r--plugins/spellcheck.lua11
1 files changed, 6 insertions, 5 deletions
diff --git a/plugins/spellcheck.lua b/plugins/spellcheck.lua
index 566bd3e..45f0e76 100644
--- a/plugins/spellcheck.lua
+++ b/plugins/spellcheck.lua
@@ -64,7 +64,7 @@ end
local draw_line_text = DocView.draw_line_text
function DocView:draw_line_text(idx, x, y)
- draw_line_text(self, idx, x, y)
+ local lh = draw_line_text(self, idx, x, y)
if
not config.plugins.spellcheck.enable
@@ -73,7 +73,7 @@ function DocView:draw_line_text(idx, x, y)
or
not matches_any(self.doc.filename or "", config.plugins.spellcheck.files)
then
- return
+ return lh
end
local s, e = 0, 0
@@ -85,12 +85,13 @@ function DocView:draw_line_text(idx, x, y)
local word = text:sub(s, e):lower()
if not words[word] and not active_word(self.doc, idx, e + 1) then
local color = style.spellcheck_error or style.syntax.keyword2
- local x1 = x + self:get_col_x_offset(idx, s)
- local x2 = x + self:get_col_x_offset(idx, e + 1)
+ local x1, y1 = self:get_line_screen_position(idx, s)
+ local x2, y2 = self:get_line_screen_position(idx, e + 1)
local h = math.ceil(1 * SCALE)
- renderer.draw_rect(x1, y + self:get_line_height() - h, x2 - x1, h, color)
+ renderer.draw_rect(x1, y1 + self:get_line_height() - h, x2 - x1, h, color)
end
end
+ return lh
end