Skip to content

Commit

Permalink
Revert "feat: Support control characters for modifying surrounds. (#…
Browse files Browse the repository at this point in the history
…179) (#209)" (#210)

This reverts commit e65628a.
  • Loading branch information
kylechui authored Feb 17, 2023
1 parent e65628a commit 9739e85
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
9 changes: 0 additions & 9 deletions lua/nvim-surround/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -227,23 +227,14 @@ M.default_opts = {
},
invalid_key_behavior = {
add = function(char)
if char:byte() < 32 then
return
end
return { { char }, { char } }
end,
find = function(char)
if char:byte() < 32 then
return
end
return M.get_selection({
pattern = vim.pesc(char) .. ".-" .. vim.pesc(char),
})
end,
delete = function(char)
if char:byte() < 32 then
return
end
return M.get_selections({
char = char,
pattern = "^(.)().-(.)()$",
Expand Down
4 changes: 2 additions & 2 deletions lua/nvim-surround/input.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ local M = {}
---@nodiscard
M.get_char = function()
local ret_val, char_num = pcall(vim.fn.getchar)
-- Return nil if error (e.g. <C-c>) or for <Esc>/<C-[> (ascii code 27)
if not ret_val or type(char_num) ~= "number" or char_num == 27 then
-- Return nil if error (e.g. <C-c>) or for control characters
if not ret_val or type(char_num) ~= "number" or char_num < 32 then
return nil
end
local char = vim.fn.nr2char(char_num)
Expand Down

0 comments on commit 9739e85

Please sign in to comment.