Skip to content

Commit 6cb52b3

Browse files
committed
chore: when debugging, log if zero-width textobject
1 parent 3e3dbfc commit 6cb52b3

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

lua/various-textobjs/charwise-core.lua

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,17 @@ function M.selectClosestTextobj(patterns, scope, lookForwLines)
158158
closest = cur
159159
end
160160

161-
-- stylua: ignore
162-
objLogging[patternName] = { cur.startCol, cur.endCol, row = cur.row, distance = cur.distance, tieloser = cur.tieloser, cursorOnObj = cur.cursorOnObj }
161+
if enableLogging then
162+
objLogging[patternName] = {
163+
cur.startCol,
164+
cur.endCol,
165+
row = cur.row,
166+
distance = cur.distance,
167+
tieloser = cur.tieloser,
168+
cursorOnObj = cur.cursorOnObj,
169+
zeroWidthTextobj = cur.startCol > cur.endCol and true or nil,
170+
}
171+
end
163172
end
164173
end
165174
end
@@ -169,8 +178,6 @@ function M.selectClosestTextobj(patterns, scope, lookForwLines)
169178
return
170179
end
171180

172-
-- set selection & log
173-
M.setSelection({ closest.row, closest.startCol }, { closest.row, closest.endCol })
174181
if enableLogging and type(patterns) == "table" then
175182
local textobj = (debug.getinfo(3, "n") or {}).name or "unknown"
176183
objLogging._closest = closest.patternName
@@ -180,6 +187,8 @@ function M.selectClosestTextobj(patterns, scope, lookForwLines)
180187
{ ft = "lua", title = scope .. " " .. textobj }
181188
)
182189
end
190+
191+
M.setSelection({ closest.row, closest.startCol }, { closest.row, closest.endCol })
183192
return closest.row, closest.startCol, closest.endCol
184193
end
185194

0 commit comments

Comments
 (0)