Skip to content

Commit 0159f29

Browse files
committed
fix: show indentation mode in approval UI even when anchor_line is omitted
- getLineSnippet() now always displays 'indentation mode at line X' when mode is indentation - getStartLine() now always returns the effective anchor line for indentation mode - Both methods use fallback chain: anchor_line ?? offset ?? 1 Addresses review feedback about approval UI not reflecting defaulted anchor_line
1 parent 6029495 commit 0159f29

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/core/tools/ReadFileTool.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -525,8 +525,9 @@ export class ReadFileTool extends BaseTool<"read_file"> {
525525
* Get the starting line number for navigation purposes.
526526
*/
527527
private getStartLine(entry: InternalFileEntry): number | undefined {
528-
if (entry.mode === "indentation" && entry.anchor_line !== undefined) {
529-
return entry.anchor_line
528+
if (entry.mode === "indentation") {
529+
// For indentation mode, always return the effective anchor line
530+
return entry.anchor_line ?? entry.offset ?? 1
530531
}
531532
const offset = entry.offset ?? 1
532533
return offset > 1 ? offset : undefined
@@ -536,8 +537,10 @@ export class ReadFileTool extends BaseTool<"read_file"> {
536537
* Generate a human-readable line snippet for approval messages.
537538
*/
538539
private getLineSnippet(entry: InternalFileEntry): string {
539-
if (entry.mode === "indentation" && entry.anchor_line !== undefined) {
540-
return `indentation mode at line ${entry.anchor_line}`
540+
if (entry.mode === "indentation") {
541+
// Always show indentation mode with the effective anchor line
542+
const effectiveAnchor = entry.anchor_line ?? entry.offset ?? 1
543+
return `indentation mode at line ${effectiveAnchor}`
541544
}
542545

543546
const limit = entry.limit ?? DEFAULT_LINE_LIMIT

0 commit comments

Comments
 (0)