diff options
author | ThaCuber <70547062+ThaCuber@users.noreply.github.com> | 2023-05-27 14:48:17 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-27 14:48:17 -0400 |
commit | ca617f5317d16d0ba0af074a68ee2ce46c343889 (patch) | |
tree | c7492e9f70e8493e5c3b9753a21a6fdef2f2f26f /plugins/smoothcaret.lua | |
parent | 299efc90133fbca6e6efc3721c81a2aa320ae56c (diff) | |
download | lite-xl-plugins-ca617f5317d16d0ba0af074a68ee2ce46c343889.tar.gz lite-xl-plugins-ca617f5317d16d0ba0af074a68ee2ce46c343889.zip |
carets-a-lot (#237)
* Update manifest.json
* Add files via upload
* Update manifest.json
* fixed trail not actually changing color when "custom color" is turned off
* added reason for for-loop around draw_char
* made surrounding character display a setting, false by default
* changed to common.lerp and fixed underline trail
* fixed carets suddenly appearing after remaking them
may be temporary
* eval was not supposed to be updated
* fixed trail appearing when scrolling
this problem was in original motiontrail lol
* `core.pop_clip_rect` doesn't have any parameters, dang it
Diffstat (limited to 'plugins/smoothcaret.lua')
-rw-r--r-- | plugins/smoothcaret.lua | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/plugins/smoothcaret.lua b/plugins/smoothcaret.lua index 5639ff2..86718de 100644 --- a/plugins/smoothcaret.lua +++ b/plugins/smoothcaret.lua @@ -31,6 +31,8 @@ config.plugins.smoothcaret = common.merge({ } }, config.plugins.smoothcaret) +local caret_idx = 1 + local docview_update = DocView.update function DocView:update() docview_update(self) @@ -96,7 +98,7 @@ function DocView:update() end -- This is used by `DocView:draw_caret` to keep track of the current caret - self.caret_idx = 1 + caret_idx = 1 end local docview_draw_caret = DocView.draw_caret @@ -106,11 +108,8 @@ function DocView:draw_caret(x, y) return end - local c = self.visible_carets[self.caret_idx] or { current = { x = x, y = y } } - local lh = self:get_line_height() - - -- We use the scroll position to move back to the position relative to the window - renderer.draw_rect(c.current.x - self.scroll.x, c.current.y - self.scroll.y, style.caret_width, lh, style.caret) + local c = self.visible_carets[caret_idx] or { current = { x = x, y = y } } + docview_draw_caret(self, c.current.x - self.scroll.x, c.current.y - self.scroll.y) - self.caret_idx = self.caret_idx + 1 + caret_idx = caret_idx + 1 end |