Skip to content

Commit

Permalink
fix: lineCharacterwise hanging on NUL
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSast authored and chrisgrieser committed Oct 1, 2024
1 parent 4384233 commit cc33e0a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lua/various-textobjs/charwise-textobjs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,11 @@ end
---current line (but characterwise)
---@param scope "inner"|"outer" outer includes indentation and trailing spaces
function M.lineCharacterwise(scope)
-- FIX being on line break in visual mode, see #108
-- FIX being on NUL, see #108 and #109
-- (Not sure why this only happens for `lineCharacterwise` though…)
-- `col()` results in "true" char, as it factors in Tabs
local isOnLineBreak = #vim.api.nvim_get_current_line() < vim.fn.col(".")
if isOnLineBreak and vim.fn.mode():find("[Vv]") and scope == "outer" then u.normal("h") end
local isOnNUL = #vim.api.nvim_get_current_line() < vim.fn.col(".")
if isOnNUL then u.normal("g_") end

local pattern = "^(%s*).-(%s*)$"
M.selectTextobj(pattern, scope, 0)
Expand Down

0 comments on commit cc33e0a

Please sign in to comment.