From 3273549e2e997767c6d6c347bde9e590d8c182cd Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Thu, 14 Mar 2024 17:28:13 +0000 Subject: Change warp to vary the width if virtualedit is enabled. --- lua/warp/util.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'lua/warp/util.lua') diff --git a/lua/warp/util.lua b/lua/warp/util.lua index 4f1858e..7030e59 100644 --- a/lua/warp/util.lua +++ b/lua/warp/util.lua @@ -29,11 +29,19 @@ M.open_horiz = function() local horiz_bufnr = vim.api.nvim_create_buf(0, 1) local line_at = vim.fn.getline(curpos[1]) - local max_width = math.min(width, #line_at + 1) + + local max_width = math.min( + width, #line_at + 1 + (vim.o.virtualedit == 'onemore' and 1 or 0)) + if vim.o.virtualedit == 'all' then + max_width = width + end return { buf = horiz_bufnr, - panel = M.new_panel(horiz_bufnr, curpos[1] - topline + 1, width_of_garbage - 1, + panel = M.new_panel( + horiz_bufnr, + curpos[1] - topline + 1, + width_of_garbage - 1, max_width + 2, 1) } end -- cgit