Skip to content

Commit

Permalink
fix(subword): pascalCase prevention not triggered in some cases
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisgrieser committed Dec 4, 2024
1 parent c17706e commit d8875e7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lua/various-textobjs/charwise-textobjs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ function M.subword(scope)
if noPascal then
local originalWasCamelCased = vim.fn.expand("<cword>"):find("%l%u") ~= nil
local charAfter = line:sub(endCol + 1, endCol + 1)
local isStartOfWord = line:sub(startCol - 1, startCol - 1) == " "
local isStartOfWord = charBefore:find("%W") or charBefore == ""
local isDeletion = vim.v.operator == "d"
if originalWasCamelCased and charAfter:find("%u") and isStartOfWord and isDeletion then
local updatedLine = line:sub(1, endCol) .. charAfter:lower() .. line:sub(endCol + 2)
Expand Down

0 comments on commit d8875e7

Please sign in to comment.