Skip to content

Commit

Permalink
fix: outer lineCharacterwise in visual hanging on line break (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisgrieser committed Sep 30, 2024
1 parent c2e4038 commit 4384233
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lua/various-textobjs/charwise-textobjs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,12 @@ 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
-- (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 pattern = "^(%s*).-(%s*)$"
M.selectTextobj(pattern, scope, 0)
end
Expand Down

0 comments on commit 4384233

Please sign in to comment.