Skip to content

Commit

Permalink
fix(fast-wrap): restore leftcol when it begins to shift text (#474)
Browse files Browse the repository at this point in the history
thanks
  • Loading branch information
xzbdmw authored Sep 2, 2024
1 parent 4b9cf01 commit fd2badc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lua/nvim-autopairs/fastwrap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ M.highlight_wrap = function(tbl_pos, row, col, end_col, whitespace_line)
if config.use_virt_lines then
local virt_lines = {}
local start = 0
local left_col = vim.fn.winsaveview().leftcol
if left_col > 0 then
vim.fn.winrestview({ leftcol = 0 })
end
for _, pos in ipairs(tbl_pos) do
virt_lines[#virt_lines + 1] = { whitespace_line:sub(start + 1, pos.pos - 1), 'Normal' }
virt_lines[#virt_lines + 1] = { pos.key, config.highlight }
Expand Down

0 comments on commit fd2badc

Please sign in to comment.