Closed NoahTheDuke closed 2 years ago
I'm not 100% sure what you did, but my guess is that it's probably related to the following: when you make a "copy" of a table in Lua, it actually makes a copy of the reference to the table, not a copy of the values. So if you have the code
local x = { 1, 2 }
local y = x
y[1] = 2
print(x) -- Should be { 2, 2 }
I'm pretty sure that's the case, so perhaps somewhere in your modified code you're modifying a reference and not the values?
BTW thanks for taking the time to contribute!
Edit: Oh wait is this a part of the main code right now‽ If so, oops
Yeah, this happens directly on master. (At last I thought so but now that I've stepped away for the night I'm unsure lol.) I looked around the rest of the code but I'm new to Lua as of this evening so I don't quite follow it all yet.
I'll take another look at it tomorrow morning; also with respect to #20 I think I should probably refactor a few other things, like using g@i instead of g@a for setting operator marks
Hi there, I think the latest commit in add-buffer-local-mappings
should resolve the issue; I've done some testing on my end and it seems to behave just fine
Edit: The other branch has since been merged into main
, so please see if the issue persists there, thanks!
Hey hey, looks like this is fixed now. Nicely done.
Hey Kyle!
I decided to try to fix #20 and ran into a separate bug that's outside of my knowledge of Lua to understand. In short,
cs)(
changes(x, y)
to( x, y )
. Andcs)(
changes( x, y )
to( x, y )
, which is expected. But if I typecs()
(which works but is effectively a NOOP), thencs)(
stops working altogether.Before typing
cs()
,vim.pretty_print(utils.delimiters.pairs)
produces:And after typing
cs()
:As you can see, for some reason the
["("]
mapping is changed from{ "( ", " )" }
to{ "(", ")" }
. I won't post the output for brevity but this happens to every single pair that has surrounding spaces.