Static| Name | Type | Description |
|---|---|---|
diff_content* | str | The unified diff content |
file_path | str | Default: ''Path to the file being modified |
tool_name | str | None | Default: NoneName of the file tool that produced the diff |
before | str | Default: '' |
after | str | Default: '' |
stats | DiffStats | None | Default: None |
outcome | DiffOutcome | Default: 'shown' |
show_caveat | bool | Default: True |
**kwargs | Any | Default: {} |
Widget displaying a diff with syntax highlighting.
Two behaviors beyond rendering, both easy to break from compose without
noticing, and documented per-parameter on __init__:
outcome other than shown replaces the diff body with a caveat
sentence. A body rendered under a lost pre-image would be a whole-file
insertion that never happened, so suppression is the honest result rather
than a degradation.+40 -3 for a credentials file still describes its
contents, so the header cannot survive a redacted body.renders_caveat reports whether this widget's body states the change could
not be shown. The adapter reads it back when deciding whether any surface
carried the caveat — conjoined with the mount result, since this says only
what the widget would render, not that it reached the screen.
Source aligned to the diff's old line numbers. Pass the
whole file, or a prefix highlight_source_prefixes previously
produced — which is what MessageData round-trips. Stored
trimmed, and dropped entirely for a credential path.
Source aligned to the diff's new line numbers, same contract.
Authoritative (additions, deletions), counted before
truncation. Always preferred over recounting the diff body;
None recounts.
What the operation can honestly say about what it changed.
Anything but shown suppresses the body and replaces it with
that outcome's caveat. Taken as the outcome rather than as
independent flags because they are not independent: a
stats-plus-"counts are fiction" pair is representable, and
whichever of the two a reader trusts, the other contradicts it.
Whether to render the outcome's caveat. Suppresses only
the sentence, never the body — an untrusted body stays hidden
either way. Pass False only when a tool row already on screen
carries the identical sentence, which for edit_file is
guaranteed: it can never be folded into a group, so both would
render adjacent. The caller owns that judgement because this
widget cannot see what else is mounted.
Additional arguments passed to parent