Skip to content
Back

Diff viewer

Review an agent's change set: unified, split or stacked, Accept / Reject (or Keep / Undo) per hunk, per file and for all with undo, a file list with Viewed marks, hidden context on demand, line comments sent to the agent together, and a minimap.

oxyn add diff-viewer
MCP
Changes4 files changed+27−5
Msrc/auth.rs+5 −2
@@ -1,9 +1,11 @@+4 −2
use crate::store::{find, Session};
Added: use crate::rate::Limiter;
/// Signs a user in.
Removed: pub fn login(id: u32, pw: &str) -> Result<Session, Denied> {
Added: pub fn login(id: u32, pw: &str, rl: &Limiter) -> Result<Session, Denied> {
Added: rl.hit(id)?;
let user = find(id)?;
Removed: let ok = check(pw);
Added: let ok = verify(pw, &user.salt)?;
if !ok {
return Err(Denied);
}
@@ -15,5 +17,6 @@fn check+1
}
pub fn logout(s: Session) {
Added: s.revoke_tokens();
s.end();
}
Msrc/session.rs+8 −1
@@ -1,11 +1,18 @@struct Session+8 −1
pub struct Session {
pub user: User,
pub started: u64,
Added: pub tokens: Vec<Token>,
}
impl Session {
pub fn new(user: User) -> Self {
Removed: Self { user, started: now() }
Added: Self { user, started: now(), tokens: Vec::new() }
Added: }
Added:
Added: pub fn revoke_tokens(&self) {
Added: for t in &self.tokens {
Added: t.revoke();
Added: }
}
pub fn end(self) {}
Asrc/rate.rs+14
@@ -0,0 +1,14 @@+14
Added: /// Five tries a minute per account.
Added: pub struct Limiter {
Added: window_ms: u64,
Added: max: u32,
Added: }
Added:
Added: impl Limiter {
Added: pub fn hit(&self, id: u32) -> Result<(), Denied> {
Added: if self.count(id) >= self.max {
Added: return Err(Denied);
Added: }
Added: Ok(())
Added: }
Added: }
Dsrc/legacy.rs−2
@@ -1,2 +0,0 @@−2
Removed: // Old cookie check, replaced by Session.
Removed: pub fn cookie_ok(c: &str) -> bool { c.len() > 8 }
Hunk 1 of 55 to review
Dioxus
let files = vec![
    FileDiff::new("src/auth.rs", old_auth, new_auth),
    FileDiff::new("src/rate.rs", "", new_rate),
];

rsx! {
    DiffViewer {
        files: files,
        wrap: true,
        on_decide: move |(hunk, d)| save(hunk, d),
        on_send: move |comments| agent.reply_to(comments),
    }
}

Rendered from Rust at build time · goes live when visible

When to use

  • The agent changed code.
  • The user wants to read the change quickly, decide hunk by hunk what stays, tell the agent what to fix, and move on — while the agent may still be writing.
  • The diff viewer is the place where trust in an agent's edits is built or lost, so it must be fast on 10,000-line files, never jump under the reader, and make "keep", "undo" and "comment" one key each.

When not to use

  • One tool call in one line: use Tool call instead.
  • A turn's tool calls grouped the way a transcript reads them: use Tool stack instead.
  • Markdown that renders correctly while it streams: use Streaming markdown instead.

Installation

Diff viewer is free and MIT. The oxyn CLI copies its code, and the components it needs, into src/oxyn/ of your Dioxus or GPUI project, so it is yours to change.

Terminal
cargo install --git https://github.com/ismailqureshi72/Oxyn oxyn-cli
oxyn init
oxyn add diff-viewer
Rust
use crate::oxyn::{DiffViewer, STATUS_INDICATOR_CSS};

Rather depend on the crate? cargo add oxyn-dioxus oxyn-core --git https://github.com/ismailqureshi72/Oxyn, then use oxyn_dioxus::{DiffViewer, STATUS_INDICATOR_CSS};

Usage

Dioxus · rust
let files = vec![
    FileDiff::new("src/auth.rs", old_auth, new_auth),
    FileDiff::new("src/rate.rs", "", new_rate),
];

rsx! {
    DiffViewer {
        files: files,
        wrap: true,
        on_decide: move |(hunk, d)| save(hunk, d),
        on_send: move |comments| agent.reply_to(comments),
    }
}

Examples

Unified

One column with two gutters, file list, minimap and the review bar.

Changes4 files changed+27−5
Msrc/auth.rs+5 −2
@@ -1,9 +1,11 @@+4 −2
use crate::store::{find, Session};
Added: use crate::rate::Limiter;
/// Signs a user in.
Removed: pub fn login(id: u32, pw: &str) -> Result<Session, Denied> {
Added: pub fn login(id: u32, pw: &str, rl: &Limiter) -> Result<Session, Denied> {
Added: rl.hit(id)?;
let user = find(id)?;
Removed: let ok = check(pw);
Added: let ok = verify(pw, &user.salt)?;
if !ok {
return Err(Denied);
}
@@ -15,5 +17,6 @@fn check+1
}
pub fn logout(s: Session) {
Added: s.revoke_tokens();
s.end();
}
Msrc/session.rs+8 −1
@@ -1,11 +1,18 @@struct Session+8 −1
pub struct Session {
pub user: User,
pub started: u64,
Added: pub tokens: Vec<Token>,
}
impl Session {
pub fn new(user: User) -> Self {
Removed: Self { user, started: now() }
Added: Self { user, started: now(), tokens: Vec::new() }
Added: }
Added:
Added: pub fn revoke_tokens(&self) {
Added: for t in &self.tokens {
Added: t.revoke();
Added: }
}
pub fn end(self) {}
Asrc/rate.rs+14
@@ -0,0 +1,14 @@+14
Added: /// Five tries a minute per account.
Added: pub struct Limiter {
Added: window_ms: u64,
Added: max: u32,
Added: }
Added:
Added: impl Limiter {
Added: pub fn hit(&self, id: u32) -> Result<(), Denied> {
Added: if self.count(id) >= self.max {
Added: return Err(Denied);
Added: }
Added: Ok(())
Added: }
Added: }
Dsrc/legacy.rs−2
@@ -1,2 +0,0 @@−2
Removed: // Old cookie check, replaced by Session.
Removed: pub fn cookie_ok(c: &str) -> bool { c.len() > 8 }
Hunk 1 of 55 to review
Code
let files = vec![
    FileDiff::new("src/auth.rs", old_auth, new_auth),
    FileDiff::new("src/rate.rs", "", new_rate),
];

rsx! {
    DiffViewer {
        files: files,
        wrap: true,
        on_decide: move |(hunk, d)| save(hunk, d),
        on_send: move |comments| agent.reply_to(comments),
    }
}

Split

Old on the left, new on the right; hatched fillers for unpaired rows.

Changes4 files changed+27−5
Msrc/auth.rs+5 −2
@@ -1,9 +1,11 @@+4 −2
use crate::store::{find, Session};
use crate::store::{find, Session};
Added: use crate::rate::Limiter;
/// Signs a user in.
/// Signs a user in.
Removed: pub fn login(id: u32, pw: &str) -> Result<Session, Denied> {
Added: pub fn login(id: u32, pw: &str, rl: &Limiter) -> Result<Session, Denied> {
Added: rl.hit(id)?;
let user = find(id)?;
let user = find(id)?;
Removed: let ok = check(pw);
Added: let ok = verify(pw, &user.salt)?;
if !ok {
if !ok {
return Err(Denied);
return Err(Denied);
}
}
@@ -15,5 +17,6 @@fn check+1
}
}
pub fn logout(s: Session) {
pub fn logout(s: Session) {
Added: s.revoke_tokens();
s.end();
s.end();
}
}
Msrc/session.rs+8 −1
@@ -1,11 +1,18 @@struct Session+8 −1
pub struct Session {
pub struct Session {
pub user: User,
pub user: User,
pub started: u64,
pub started: u64,
Added: pub tokens: Vec<Token>,
}
}
impl Session {
impl Session {
pub fn new(user: User) -> Self {
pub fn new(user: User) -> Self {
Removed: Self { user, started: now() }
Added: Self { user, started: now(), tokens: Vec::new() }
Added: }
Added:
Added: pub fn revoke_tokens(&self) {
Added: for t in &self.tokens {
Added: t.revoke();
Added: }
}
}
pub fn end(self) {}
pub fn end(self) {}
Asrc/rate.rs+14
@@ -0,0 +1,14 @@+14
Added: /// Five tries a minute per account.
Added: pub struct Limiter {
Added: window_ms: u64,
Added: max: u32,
Added: }
Added:
Added: impl Limiter {
Added: pub fn hit(&self, id: u32) -> Result<(), Denied> {
Added: if self.count(id) >= self.max {
Added: return Err(Denied);
Added: }
Added: Ok(())
Added: }
Added: }
Dsrc/legacy.rs−2
@@ -1,2 +0,0 @@−2
Removed: // Old cookie check, replaced by Session.
Removed: pub fn cookie_ok(c: &str) -> bool { c.len() > 8 }
Hunk 1 of 55 to review
Code
let files = vec![
    FileDiff::new("src/auth.rs", old_auth, new_auth),
    FileDiff::new("src/rate.rs", "", new_rate),
];

rsx! {
    DiffViewer {
        files: files,
        layout: "split",
        wrap: true,
        on_decide: move |(hunk, d)| save(hunk, d),
        on_send: move |comments| agent.reply_to(comments),
    }
}

Stacked

A Before block over an After block per hunk, for narrow panels.

Changes4 files changed+27−5
Msrc/auth.rs+5 −2
@@ -1,9 +1,11 @@+4 −2
Before
use crate::store::{find, Session};
/// Signs a user in.
Removed: pub fn login(id: u32, pw: &str) -> Result<Session, Denied> {
let user = find(id)?;
Removed: let ok = check(pw);
if !ok {
return Err(Denied);
}
After
use crate::store::{find, Session};
Added: use crate::rate::Limiter;
/// Signs a user in.
Added: pub fn login(id: u32, pw: &str, rl: &Limiter) -> Result<Session, Denied> {
Added: rl.hit(id)?;
let user = find(id)?;
Added: let ok = verify(pw, &user.salt)?;
if !ok {
return Err(Denied);
}
@@ -15,5 +17,6 @@fn check+1
Before
}
pub fn logout(s: Session) {
s.end();
}
After
}
pub fn logout(s: Session) {
Added: s.revoke_tokens();
s.end();
}
Msrc/session.rs+8 −1
@@ -1,11 +1,18 @@struct Session+8 −1
Before
pub struct Session {
pub user: User,
pub started: u64,
}
impl Session {
pub fn new(user: User) -> Self {
Removed: Self { user, started: now() }
}
pub fn end(self) {}
After
pub struct Session {
pub user: User,
pub started: u64,
Added: pub tokens: Vec<Token>,
}
impl Session {
pub fn new(user: User) -> Self {
Added: Self { user, started: now(), tokens: Vec::new() }
Added: }
Added:
Added: pub fn revoke_tokens(&self) {
Added: for t in &self.tokens {
Added: t.revoke();
Added: }
}
pub fn end(self) {}
Asrc/rate.rs+14
@@ -0,0 +1,14 @@+14
Before
After
Added: /// Five tries a minute per account.
Added: pub struct Limiter {
Added: window_ms: u64,
Added: max: u32,
Added: }
Added:
Added: impl Limiter {
Added: pub fn hit(&self, id: u32) -> Result<(), Denied> {
Added: if self.count(id) >= self.max {
Added: return Err(Denied);
Added: }
Added: Ok(())
Added: }
Added: }
Dsrc/legacy.rs−2
@@ -1,2 +0,0 @@−2
Before
Removed: // Old cookie check, replaced by Session.
Removed: pub fn cookie_ok(c: &str) -> bool { c.len() > 8 }
After
Hunk 1 of 55 to review
Code
let files = vec![
    FileDiff::new("src/auth.rs", old_auth, new_auth),
    FileDiff::new("src/rate.rs", "", new_rate),
];

rsx! {
    DiffViewer {
        files: files,
        layout: "stacked",
        wrap: true,
        on_decide: move |(hunk, d)| save(hunk, d),
        on_send: move |comments| agent.reply_to(comments),
    }
}

Applied

Edits already on disk: Keep / Undo instead of Accept / Reject.

Changes4 files changed+27−5
Msrc/auth.rs+5 −2
@@ -1,9 +1,11 @@+4 −2
use crate::store::{find, Session};
Added: use crate::rate::Limiter;
/// Signs a user in.
Removed: pub fn login(id: u32, pw: &str) -> Result<Session, Denied> {
Added: pub fn login(id: u32, pw: &str, rl: &Limiter) -> Result<Session, Denied> {
Added: rl.hit(id)?;
let user = find(id)?;
Removed: let ok = check(pw);
Added: let ok = verify(pw, &user.salt)?;
if !ok {
return Err(Denied);
}
@@ -15,5 +17,6 @@fn check+1
}
pub fn logout(s: Session) {
Added: s.revoke_tokens();
s.end();
}
Msrc/session.rs+8 −1
@@ -1,11 +1,18 @@struct Session+8 −1
pub struct Session {
pub user: User,
pub started: u64,
Added: pub tokens: Vec<Token>,
}
impl Session {
pub fn new(user: User) -> Self {
Removed: Self { user, started: now() }
Added: Self { user, started: now(), tokens: Vec::new() }
Added: }
Added:
Added: pub fn revoke_tokens(&self) {
Added: for t in &self.tokens {
Added: t.revoke();
Added: }
}
pub fn end(self) {}
Asrc/rate.rs+14
@@ -0,0 +1,14 @@+14
Added: /// Five tries a minute per account.
Added: pub struct Limiter {
Added: window_ms: u64,
Added: max: u32,
Added: }
Added:
Added: impl Limiter {
Added: pub fn hit(&self, id: u32) -> Result<(), Denied> {
Added: if self.count(id) >= self.max {
Added: return Err(Denied);
Added: }
Added: Ok(())
Added: }
Added: }
Dsrc/legacy.rs−2
@@ -1,2 +0,0 @@−2
Removed: // Old cookie check, replaced by Session.
Removed: pub fn cookie_ok(c: &str) -> bool { c.len() > 8 }
Hunk 1 of 55 to review
Code
let files = vec![
    FileDiff::new("src/auth.rs", old_auth, new_auth),
    FileDiff::new("src/rate.rs", "", new_rate),
];

rsx! {
    DiffViewer {
        files: files,
        mode: ReviewMode::Applied,
        wrap: true,
        on_decide: move |(hunk, d)| save(hunk, d),
        on_send: move |comments| agent.reply_to(comments),
    }
}

Bar style

Stripe-only change marks for dense IDE panels.

Changes4 files changed+27−5
Msrc/auth.rs+5 −2
@@ -1,9 +1,11 @@+4 −2
use crate::store::{find, Session};
Added: use crate::rate::Limiter;
/// Signs a user in.
Removed: pub fn login(id: u32, pw: &str) -> Result<Session, Denied> {
Added: pub fn login(id: u32, pw: &str, rl: &Limiter) -> Result<Session, Denied> {
Added: rl.hit(id)?;
let user = find(id)?;
Removed: let ok = check(pw);
Added: let ok = verify(pw, &user.salt)?;
if !ok {
return Err(Denied);
}
@@ -15,5 +17,6 @@fn check+1
}
pub fn logout(s: Session) {
Added: s.revoke_tokens();
s.end();
}
Msrc/session.rs+8 −1
@@ -1,11 +1,18 @@struct Session+8 −1
pub struct Session {
pub user: User,
pub started: u64,
Added: pub tokens: Vec<Token>,
}
impl Session {
pub fn new(user: User) -> Self {
Removed: Self { user, started: now() }
Added: Self { user, started: now(), tokens: Vec::new() }
Added: }
Added:
Added: pub fn revoke_tokens(&self) {
Added: for t in &self.tokens {
Added: t.revoke();
Added: }
}
pub fn end(self) {}
Asrc/rate.rs+14
@@ -0,0 +1,14 @@+14
Added: /// Five tries a minute per account.
Added: pub struct Limiter {
Added: window_ms: u64,
Added: max: u32,
Added: }
Added:
Added: impl Limiter {
Added: pub fn hit(&self, id: u32) -> Result<(), Denied> {
Added: if self.count(id) >= self.max {
Added: return Err(Denied);
Added: }
Added: Ok(())
Added: }
Added: }
Dsrc/legacy.rs−2
@@ -1,2 +0,0 @@−2
Removed: // Old cookie check, replaced by Session.
Removed: pub fn cookie_ok(c: &str) -> bool { c.len() > 8 }
Hunk 1 of 55 to review
Code
let files = vec![
    FileDiff::new("src/auth.rs", old_auth, new_auth),
    FileDiff::new("src/rate.rs", "", new_rate),
];

rsx! {
    DiffViewer {
        files: files,
        change_style: "bars",
        wrap: true,
        on_decide: move |(hunk, d)| save(hunk, d),
        on_send: move |comments| agent.reply_to(comments),
    }
}

Focus dim

Only the current hunk is at full strength.

Changes1 file changed+5−2
Msrc/auth.rs+5 −2
@@ -1,9 +1,11 @@+4 −2
use crate::store::{find, Session};
Added: use crate::rate::Limiter;
/// Signs a user in.
Removed: pub fn login(id: u32, pw: &str) -> Result<Session, Denied> {
Added: pub fn login(id: u32, pw: &str, rl: &Limiter) -> Result<Session, Denied> {
Added: rl.hit(id)?;
let user = find(id)?;
Removed: let ok = check(pw);
Added: let ok = verify(pw, &user.salt)?;
if !ok {
return Err(Denied);
}
@@ -15,5 +17,6 @@fn check+1
}
pub fn logout(s: Session) {
Added: s.revoke_tokens();
s.end();
}
Hunk 1 of 22 to review
Code
let files = vec![
    FileDiff::new("src/auth.rs", old_auth, new_auth),
    FileDiff::new("src/rate.rs", "", new_rate),
];

rsx! {
    DiffViewer {
        files: files,
        wrap: true,
        focus_dim: true,
        on_decide: move |(hunk, d)| save(hunk, d),
        on_send: move |comments| agent.reply_to(comments),
    }
}

API reference

DiffViewer

PropTypeDefaultDescription
filesrequiredVec<FileDiff>—Files in first-touch order.
modeReviewModeDefault::default()`Proposed` (Accept / Reject) or `Applied` (Keep / Undo).
layoutString"unified"`unified` · `split` · `stacked`.
change_styleString"background"`background` · `markers` · `bars`.
file_listbooltrueFile list on the left.
word_diffbooltrueWord-level highlights on paired lines.
wrapboolDefault::default()Wrap long lines.
line_numbersbooltrueLine-number gutters.
minimapbooltrueOverview ruler at the end edge.
commentsbooltrueLine comments.
focus_dimboolDefault::default()Dim every hunk but the current one.
switcherbooltrueLayout switcher in the header.
titleString"Changes"Heading.
on_decideEventHandler<(HunkRef, Decision)>—A hunk was decided (`Pending` = restored).
on_sendEventHandler<Vec<LineComment>>—Comments sent to the agent.
on_viewedEventHandler<(usize, bool)>—A file's Viewed mark changed.

Read from the Rust signature and doc comments.

Keyboard interactions

KeyAction
jorkNext / previous hunk
[or]Previous / next file
yorxAccept (Keep) / Reject (Undo) the current hunk
cComment on the current hunk; ⌘↵ adds it, Esc closes
zUndo the last decision
⌘↵Send every draft comment to the agent

Accessibility

  • Every changed line starts with a hidden “Added:” or “Removed:”, so the diff never relies on the tint; the + and − signs carry it on screen too.
  • Hunk buttons name their hunk (“Accept fn login”) and carry aria-keyshortcuts; each decision updates a polite status line that says how many hunks remain.
  • The layout switch is a radio group; Viewed is a real checkbox; the file list marks the current file with aria-current.
  • Reduced motion drops the chip pop, row fades and the smooth scroll to the next hunk.
From the spec
  • Structure. Viewer is a region "Changes, 4 files, 58 lines added, 21 removed". File list is a tree (or listbox when flat). Each file is a region labelled by its header; each hunk is a group "Hunk 2 of 5 in auth.rs, lines 40 to 52, 1 added 1 removed, pending". Lines are rows in a grid (split: two cells per row) so screen readers can move by line and by column.
  • Line names. "Line 41, added: let ok = verify(pw, &user.salt)?" and for paired lines a summary of the word change on request (i reads "changed check to verify, added user.salt") — never only colour.
  • Keyboard. All single-letter keys work only when focus is inside the viewer and not in a text field; every key has a menu equivalent; ? opens the shortcuts sheet. j/k hunks, n/p or ]/[ files, ↑/↓ lines, Shift+↑/↓ extend selection for comments, y/u decide, r restore, c comment, ⌘↩ send comments, v viewed, s layout, w wrap, e expand/collapse all, x expand context, f follow, o open in editor, Esc closes the comment composer then the viewer.
  • Live region (polite): decisions ("Hunk kept. 3 of 12 remaining."), bulk results ("Kept 12 hunks in 4 files."), streaming start / finish per file once ("Agent is editing session.rs" / "Finished editing session.rs, 30 added, 15 removed"), comments sent. Rolling counts are never announced per tick. Conflicts and write failures assertive once.
  • Focus. Auto-advance moves focus only if focus was on the decided hunk; it never steals focus from a comment composer or the file list. After bulk actions focus stays on the button.
  • Contrast. Code text on tints ≥ 4.5:1 (auto-corrected, §2.3); word highlights ≥ 3:1 against the row tint plus an underline in high-contrast mode; +/− signs always present; minimap marks are decorative (their information is in the file list and review bar).
  • Colour-blind. daltonized token preset (checkpoints-git.md §5.2).
  • Reduced motion. §6 last row.

Motion & interaction

  • Hunk focus. j/k move a 2 px focus outline (spring.snap, 160 ms) and scroll the hunk to the upper third (ease.out 200 ms); the review bar counter rolls "Hunk 3 → 4 of 12".
  • Action reveal. On hover or focus, hunk actions fade in (120 ms); they reserve their space in the header, so nothing shifts. On touch and in IDE density they are always visible.
  • Keep. Rows' tint fades to neutral (dur.hunk.resolve, 240 ms ease.out); the action group morphs into a "Kept ✓" chip (160 ms spring.snap, ✓ stroke 240 ms); the file's progress glyph advances (○ → ◐ → ●) and the header counts update (+12 −3 → "+8 −2 of +12 −3" in partially-kept files, file-edit-chip.md format). Focus jumps to the next pending hunk after 120 ms (proposed auto_advance, on by default; Windsurf's count updates as you accept one by one, note 08 §1.13).
  • Undo. Added lines get a strike drawn start → end (200 ms) and dim to 50 %; removed lines lose their tint and become context; after delay.auto_collapse (1200 ms) the hunk collapses to its header (dur.collapse) with "Undone · Restore". Restore plays it back.
  • Bulk (Keep all / Undo all). Hunks resolve in document order with stagger.bulk (30 ms, cap 8 — the rest resolve together); off-screen hunks resolve instantly; the review bar shows progress. Undo all on applied changes spanning > 1 file asks an inline confirm in the review bar ("Undo 12 hunks in 4 files? Undo · Cancel") — no modal.
  • Comment. Hover a line shows a "+" in the gutter (Claude desktop pattern, note 03); click or c opens an inline comment composer under the line (dur.expand); Shift+click or Shift+↑/↓ extends to a range (Hoplite range comments, note 10), the range gets a 2 px accent bar in the gutter. Drafts batch; ⌘↩ sends all; on send, threads collapse to a 💬 chip with "Sent" and the agent's replies appear in them.
  • Layout switch. 160 ms crossfade between layouts (dur.layout.switch), the focused hunk (or the line under the pointer) keeps its screen position (scroll anchoring).
  • Context expand. Gap row opens to the requested lines with dur.context.expand (180 ms spring.snap), content above fixed.
  • Streaming. Lines fade in (120 ms); the write head bar slides to the next line (80 ms ease.out); hunk counts roll; a file finishing writing gets a single 600 ms dur.highlight.fade-style header wash.
  • Viewed. Ticking Viewed draws the check, collapses the file (dur.collapse) and the "2 of 4 viewed" counter rolls; the file list row dims to 70 %.
  • Minimap. Viewport box follows scroll at 60 Hz; hover over a mark shows a tooltip ("Hunk 7 · +4 −1 · 2 comments") after 200 ms.
  • Failure. Chip morphs to ✕ with the tools.md error nudge on the glyph only; rows never shake.
Timing
TransitionDurationDelayEasing / springStaggerFrame rate
Loading skeleton—150 ms——30 Hz shimmer
Hunk focus outline + scroll160 ms + 200 ms0spring.snap / ease.out—60 Hz
Action reveal120 ms0 (hover)ease.out—60 Hz
Keep: tint fade + chip morph + ✓240 + 160 + 240 ms0ease.out / spring.snap—60 Hz
Auto-advance to next hunkas focus120 ms after decisionease.out—60 Hz
Undo strike + dim200 ms0ease.out—60 Hz
Undone collapse280 ms (dur.collapse)1200 msease.in—60 Hz
Bulk cascade240 ms each0ease.out30 ms, cap 860 Hz
Comment composer open / close220 ms / 280 ms0spring.snap / ease.in—60 Hz
Layout switch160 ms crossfade0ease.in-out—60 Hz
Context expand180 ms0spring.snap—60 Hz
Streaming line enter120 ms opacity0ease.outbatched ≤ 30 Hz30 Hz
Write head move80 ms0ease.out—60 Hz
Follow scroll200 ms, ≤ 1 per 250 ms0ease.out—60 Hz
Count roll (hunk / file / review bar)280 ms0ease.out30 ms digits30 Hz
File done wash600 ms0ease.out—30 Hz
Viewed collapse280 msafter ✓ 240 msease.in—60 Hz
Minimap tooltip140 ms200 msease.out—60 Hz
Send label swap / "Sent ✓" hold120 ms / 600 ms0ease.out—60 Hz
Reduced motionno scroll animation (jump), no outline spring (outline appears), keep / undo swap tint and chip with an 80 ms crossfade, no strike draw (strike appears), no cascade (bulk resolves at once), layout switch instant with anchoring kept, streaming lines appear without fade and follow jumps at most once per 1 s, no washes (2 px static bar for 2 s), counts swap—linearnoneevent-driven

Responsive behaviour

  • Container query: under 640 px the file list becomes a sideways strip, the minimap hides and comments lose their indent.
  • Long lines scroll inside the diff (or wrap with Wrap); the file header stays pinned while you scroll a file.
Edge cases (spec)
  • Huge change sets (500+ files): file list virtualised; diff body is one virtualised scroll; files load lazily as they approach the viewport (± 2 screens); first paint budget < 100 ms for the visible region (proposed).
  • Very fast agents. A file that streams and settles inside delay.row_guard (150 ms) renders settled with no streaming state.
  • Very slow agents. A streaming file with no new lines for tool_stall (120 s, tools.md) shows "No changes for 2 min" in its header; the write head stops (no looping animation).
  • Edits arrive while reviewing. New hunks in already-decided files mark the file ◐ again and enter with a 1600 ms dur.highlight.fade tint; decisions already made are kept unless the new edit overlaps a decided hunk, which then becomes Edited (agent version) and asks for review again.
  • User edits the file outside the viewer. Overlapping hunks → Conflict (Resolve opens merge-conflict.md); non-overlapping hunks re-anchor silently.
  • Proposed-mode timeouts. If the approval behind a proposed edit is cancelled (run stopped), the diff becomes ReadOnly with "Edit was cancelled".
  • Checkpoint preview / replay. Viewer renders ReadOnly with the snapshot-banner context; all decision keys are inert and announce "Viewing a past state".
  • Long lines with wrap off. Horizontal scroll per file (split: both panes scroll together); wrap on: continuation rows get a ↪ in the gutter and no line number.
  • Tabs vs spaces. Tabs render at the host's tab width (default 4, proposed); whitespace-only diffs can be hidden (§2.2).
  • RTL UI. Chrome mirrors (file list moves to the end edge, review bar order mirrors); code, gutters, line numbers and the split old/new order stay LTR (old left, new right) in a bidi isolate. RTL text inside code lines renders per Unicode bidi but word-diff marks follow logical order.
  • Tiny sizes. Under 360 px only stacked is offered; under 240 px the viewer opens as a full-screen sheet; file list becomes a dropdown; minimap hidden under 480 px.
  • Dense IDE panels. 18 px rows, 12 px mono, actions as icons with tooltips, always visible; hunk headers 20 px.
  • Touch. 44 px targets for actions (header grows, rows don't); long-press a line to comment; two-finger horizontal scroll inside code; hunk-cards for swipe review.
  • Slow networks / remote host. Skeleton after 150 ms; files stream in as they load; decisions queue locally and show Applying until the host confirms; offline → ReadOnly with queued comments kept as drafts.
  • Secrets. Lines the adapter marks redacted render as •••• with "Redacted" in the gutter; copy excludes them.
  • Copy semantics. Copying from unified / split copies the new side's text without signs or line numbers by default; Alt-copy copies the patch.

Notes for AI

  • Import DiffViewer from oxyn_dioxus and include STATUS_INDICATOR_CSS plus the token stylesheet once.
  • A GPUI version exists: DiffViewerEl in oxyn_gpui.
  • Props to set first: files.
  • Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.

Guides

Oxyn · 74 free components · 264 Pro components · 96 screens · 20 blocks · Dioxus and GPUI