From 7f37451398caf2715bf64f55e0920c53edcd941a Mon Sep 17 00:00:00 2001 From: Francesco Abbate Date: Sun, 28 Mar 2021 00:03:03 +0100 Subject: [PATCH] Implement mode dependent caret --- data/core/docview.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/data/core/docview.lua b/data/core/docview.lua index 11923181..6e77ab57 100644 --- a/data/core/docview.lua +++ b/data/core/docview.lua @@ -362,7 +362,13 @@ function DocView:draw_line_body(idx, x, y) and system.window_has_focus() then local lh = self:get_line_height() local x1 = x + self:get_col_x_offset(line, col) - renderer.draw_rect(x1, y, style.caret_width, lh, style.caret) + local caret_width + if core.vim_mode and self.editing_mode == 'command' then + caret_width = self:get_font():get_width(self.doc.lines[line1]:sub(col1, col1)) + else + caret_width = style.caret_width + end + renderer.draw_rect(x1, y, caret_width, lh, style.caret) end end