From ca617f5317d16d0ba0af074a68ee2ce46c343889 Mon Sep 17 00:00:00 2001 From: ThaCuber <70547062+ThaCuber@users.noreply.github.com> Date: Sat, 27 May 2023 14:48:17 -0400 Subject: 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 --- plugins/smoothcaret.lua | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'plugins/smoothcaret.lua') 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 -- cgit v1.2.3