Skip to content

Commit

Permalink
fix: Insert surrounds on last column.
Browse files Browse the repository at this point in the history
* When querying the user for input, the column gets clamped to the
  nearest valid column, i.e. #line. This fix grabs the cursor position
  before clamping occurs, allowing for proper insertion at the end of
  the line.
  • Loading branch information
kylechui committed Aug 5, 2022
1 parent f6ac5f3 commit 6e5d744
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lua/nvim-surround/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ end
-- Add delimiters around the cursor, in insert mode.
M.insert_surround = function(line_mode)
local char = utils.get_char()
local curpos = buffer.get_curpos()
local delimiters = utils.get_delimiters(char)
if not delimiters then
return
end
local curpos = buffer.get_curpos()

-- Add new lines if the addition is done line-wise
if line_mode then
Expand Down

0 comments on commit 6e5d744

Please sign in to comment.