summaryrefslogtreecommitdiff
path: root/lua/warp/util.lua
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2024-03-14 17:28:13 +0000
committerJosh Rahm <rahm@google.com>2024-03-14 17:28:13 +0000
commit3273549e2e997767c6d6c347bde9e590d8c182cd (patch)
tree30c73137fc020373b302e681cbaddfd66250dba8 /lua/warp/util.lua
parent0b8f5ede2d37ad302f9a892b7bc099cb3bdfaca0 (diff)
downloadnvim-warp-3273549e2e997767c6d6c347bde9e590d8c182cd.tar.gz
nvim-warp-3273549e2e997767c6d6c347bde9e590d8c182cd.tar.bz2
nvim-warp-3273549e2e997767c6d6c347bde9e590d8c182cd.zip
Change warp to vary the width if virtualedit is enabled.
Diffstat (limited to 'lua/warp/util.lua')
-rw-r--r--lua/warp/util.lua12
1 files changed, 10 insertions, 2 deletions
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