Skip to content

Commit

Permalink
fix: Round down columns to nearest valid index.
Browse files Browse the repository at this point in the history
  • Loading branch information
kylechui committed Aug 2, 2022
1 parent 117ef6d commit af61634
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lua/nvim-surround/buffer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ end
---@param pos integer[] The position to be inserted at.
---@param text string[] The text to be added.
M.insert_text = function(pos, text)
pos[2] = math.min(pos[2], #M.get_line(pos[1]) + 1)
vim.api.nvim_buf_set_text(0, pos[1] - 1, pos[2] - 1, pos[1] - 1, pos[2] - 1, text)
end

Expand Down

0 comments on commit af61634

Please sign in to comment.