Skip to content

Commit

Permalink
fix: Translate char to termcodes when reading input (#271) (#273)
Browse files Browse the repository at this point in the history
In ‘config.translate_opts()’, the chars specified in the ‘surrounds’
portion of a configuration are translated to Vim internal representation
in order to support special characters.  As a result though, we need to
actually translate the users input.  Otherwise configuration of certain
Unicode characters such as U+2019 RIGHT SINGLE QUOTATION MARK may not
work.

Co-authored-by: Kyle Chui <48545987+kylechui@users.noreply.github.com>
  • Loading branch information
Mango0x45 and kylechui committed Nov 11, 2023
1 parent e66589c commit cfa2da7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lua/nvim-surround/input.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ M.get_char = function()
if not ok or char == "\27" then
return nil
end
return char
-- Call this function, because config.translate_opts() does too
return vim.api.nvim_replace_termcodes(char, true, true, true)
end

-- Gets a string input from the user.
Expand Down

0 comments on commit cfa2da7

Please sign in to comment.