diff options
| author | Jeremy Mack <[email protected]> | 2025-07-16 09:09:05 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-16 09:09:05 -0500 |
| commit | 5d67e13df5959e51f8266acfdc8e18eafa7d5f61 (patch) | |
| tree | 514119999bcad67dfb71fc476818a3b7454fd671 | |
| parent | 57d1a60efcd0bc7cc5709fac75a46270e344e43d (diff) | |
| download | opencode-5d67e13df5959e51f8266acfdc8e18eafa7d5f61.tar.gz opencode-5d67e13df5959e51f8266acfdc8e18eafa7d5f61.zip | |
fix: grep omitting text after a colon (#1053)
| -rw-r--r-- | packages/opencode/src/tool/grep.ts | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/packages/opencode/src/tool/grep.ts b/packages/opencode/src/tool/grep.ts index cd28fb482..898e3e736 100644 --- a/packages/opencode/src/tool/grep.ts +++ b/packages/opencode/src/tool/grep.ts @@ -55,12 +55,11 @@ export const GrepTool = Tool.define({ for (const line of lines) { if (!line) continue - const parts = line.split(":", 3) - if (parts.length < 3) continue + const [filePath, lineNumStr, ...lineTextParts] = line.split(":") + if (!filePath || !lineNumStr || lineTextParts.length === 0) continue - const filePath = parts[0] - const lineNum = parseInt(parts[1], 10) - const lineText = parts[2] + const lineNum = parseInt(lineNumStr, 10) + const lineText = lineTextParts.join(":") const file = Bun.file(filePath) const stats = await file.stat().catch(() => null) |
