filesystem: show real file line numbers in unified diffs
_number_diff parses @@ hunk headers and prefixes each content line with its
real file line number: removed/context lines use the old (from) number,
added lines use the new (to) number, in `{marker} {num}│ {content}` form
(marker first so existing startswith highlighting stays valid; column
right-aligned to the largest line number). Hunk/file headers and the
`\ No newline` marker are left unchanged.

Applied in _unified_diff (covers edit / edit_lines / smart_edit) and the
`diff` action — a single server-side change, so both the TUI and the web
client receive numbered diffs in the tool result text.

TUI highlight_unified_diff renders the `{marker} {num}│` column dim and the
content in the marker color, so the number reads as meta, not as part of the
added/removed text. Lines without the prefix (standalone `diff` event, older
callers) are still colored whole.

Co-Authored-By: Claude <noreply@anthropic.com>
1 parent c65c664 commit 2051456c7080ae5985b5aaff0023abedd757382d
@Eugene Sukhodolskiy Eugene Sukhodolskiy authored 1 day ago
Showing 4 changed files
View
clients/terminal/tui/renderers/diff.py
View
navi/tools/filesystem.py
View
tests/clients/test_filesystem_renderer.py
View
tests/unit/tools/test_filesystem.py