Skip to content

Commit

Permalink
fix: Re-enable aliases (oops).
Browse files Browse the repository at this point in the history
  • Loading branch information
kylechui committed Aug 2, 2022
1 parent e3d449f commit 6bc0487
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lua/nvim-surround/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ end
-- Gets a pair of selections from the buffer based on some heuristic.
---@param args { char: string?, pattern: string? }
M.get_selections = function(args)
if args.pattern then
if args.char and args.pattern then
return require("nvim-surround.utils").get_selections(args.char, args.pattern)
end
end
Expand All @@ -354,7 +354,7 @@ end

-- Returns the add key for the surround associated with a given character, if one exists.
---@param char string? The input character.
---@return fun(): string[][]? @The function to get the delimiters to be added.
---@return fun(string?): string[][]? @The function to get the delimiters to be added.
M.get_add = function(char)
char = require("nvim-surround.utils").get_alias(char)
local key = M.get_opts().delimiters[char] or M.get_opts().delimiters.invalid_key_behavior
Expand Down
4 changes: 2 additions & 2 deletions lua/nvim-surround/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ M.delete_surround = function(args)
end

-- Get the selections to delete
local selections = config.get_delete(args.del_char)(args.del_char)
local selections = utils.get_nearest_selections(args.del_char, "delete")

if selections then
-- Delete the right selection first to ensure selection positions are correct
Expand Down Expand Up @@ -174,7 +174,7 @@ M.change_surround = function(args)
end

-- Get the selections to change
local selections = config.get_change(args.del_char).target(args.del_char)
local selections = utils.get_nearest_selections(args.del_char, "change")
if selections then
local delimiters = args.add_delimiters()
-- Change the right selection first to ensure selection positions are correct
Expand Down

0 comments on commit 6bc0487

Please sign in to comment.