Skip to content

Commit 8a50bfe

Browse files
ThomasK33claude
andcommitted
fix(terminal): treat 0.12.2 prerelease nightlies as affected (#161)
Claude review: is_affected_version() ignored vim.version().prerelease, so a "0.12.2-dev" nightly built before the #39152 backport landed reports version 0.12.2 and was treated as fixed (shim off) despite still having the bug. Treat a 0.12.2 prerelease as affected; the 0.12.2 release (prerelease == nil) and 0.13+ remain unaffected. Enabling the shim on a build that already has the fix is a verified no-op, so erring toward "affected" at the boundary is safe. Adds unit tests for the prerelease boundary. Change-Id: Iaa21f112cb21a16120fef269eec6361e0639796d Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Thomas Kosiewski <tk@coder.com>
1 parent da05ebc commit 8a50bfe

2 files changed

Lines changed: 32 additions & 1 deletion

File tree

lua/claudecode/terminal/paste_fix.lua

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,17 @@ function M.is_affected_version()
2727
end
2828
local minor = v.minor or 0
2929
local patch = v.patch or 0
30-
return minor < 12 or (minor == 12 and patch < 2)
30+
if minor < 12 or (minor == 12 and patch < 2) then
31+
return true
32+
end
33+
-- The fix shipped in the 0.12.2 *release*. A 0.12.2 prerelease/nightly
34+
-- (vim.version().prerelease is set, e.g. "dev") can predate the backport, so
35+
-- treat it as affected. Enabling the shim on a build that already has the fix
36+
-- is a verified no-op, so erring toward "affected" at the boundary is safe.
37+
if minor == 12 and patch == 2 and v.prerelease then
38+
return true
39+
end
40+
return false
3141
end
3242

3343
--- Resolve whether the shim should be active for a given config value.

tests/unit/terminal/paste_fix_spec.lua

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,27 @@ describe("claudecode.terminal.paste_fix", function()
123123
assert.are.equal(expected, paste_fix.is_affected_version())
124124
end)
125125
end
126+
127+
it("treats a 0.12.2 prerelease (nightly built before the backport) as affected", function()
128+
vim.version = function()
129+
return { major = 0, minor = 12, patch = 2, prerelease = "dev" }
130+
end
131+
assert.is_true(paste_fix.is_affected_version())
132+
end)
133+
134+
it("treats the 0.12.2 release (no prerelease) as fixed", function()
135+
vim.version = function()
136+
return { major = 0, minor = 12, patch = 2, prerelease = nil }
137+
end
138+
assert.is_false(paste_fix.is_affected_version())
139+
end)
140+
141+
it("treats a 0.13.0 prerelease as fixed (past the boundary)", function()
142+
vim.version = function()
143+
return { major = 0, minor = 13, patch = 0, prerelease = "dev" }
144+
end
145+
assert.is_false(paste_fix.is_affected_version())
146+
end)
126147
end)
127148

128149
describe("install (cooperative override)", function()

0 commit comments

Comments
 (0)