Skip to content

Commit bebc36a

Browse files
committed
fix: correct off-by-one indexing error in openFile text pattern search
Address Copilot review comment: when searching for endText pattern, line_idx is already the correct 1-based index for the lines array, so accessing lines[line_idx + 1] was incorrect. Changed to lines[line_idx] to access the current line directly. Change-Id: I05853ff183ef8f3e5df2863d2184a0cb58cb7e65 Signed-off-by: Thomas Kosiewski <[email protected]>
1 parent d0f1f73 commit bebc36a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lua/claudecode/tools/open_file.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ local function handler(params)
200200
-- Find end text if provided
201201
if params.endText then
202202
for line_idx = start_line_idx + 1, #lines do
203-
local line = lines[line_idx + 1] -- Convert back to 1-based for lines array
203+
local line = lines[line_idx] -- Access current line directly
204204
if line then
205205
local col_idx = string.find(line, params.endText, 1, true)
206206
if col_idx then

0 commit comments

Comments
 (0)