Skip to content

Diff viewer

In review
Live · web

Unified ↔ Split: toggle the view (tab to it, Enter / Space)

app/src/main/java/com/nockerl/app/net/Backoff.kt+5-3
@@ -1,9 +1,11 @@
package com.nockerl.app.net
/** Exponential backoff for SSE reconnects. */
import kotlin.random.Random
/** Exponential backoff for SSE reconnects, capped + jittered. */
fun nextDelay(attempt: Int): Long {
val base = minOf(15_000L, 1_000L shl attempt)
return base
val base = minOf(30_000L, 1_000L shl attempt)
return base + Random.nextLong(250)
}
fun shouldRetry(code: Int): Boolean = code in 500..599

Collapsed context: long unchanged runs fold behind an Expand button

src/gateway/stream.ts+1-1
@@ -1,15 +1,15 @@
import { Hono } from 'hono';
for await (const ev of bus.subscribe(id, since)) {
await sse.writeSSE({ data: JSON.stringify(ev) });
await sse.writeSSE({ event: ev.type, data: JSON.stringify(ev) });
}
});
});
export default app;

Showing the unified view · the diff is the real LCS computeLineDiff. The island is live.

// Web: React, consuming @dizyx/nockerl-tokens. (Web is the laggard platform. Spec + live demo,
// not yet exported from @dizyx/nockerl-react; promotion is tracked.)
export function ReviewDiff({ before, after }: { before: string; after: string }) {
return (
<DiffViewer
path="app/src/main/java/com/nockerl/app/net/Backoff.kt"
language="kotlin"
prev={before}
next={after}
view="unified" // 'unified' | 'split' (old left / new right)
collapseContext={3} // fold runs of unchanged lines behind an Expand control
/>
);
}
PropTypeDefaultDescription
path *stringFile path in the header: the directory is muted, the basename emphasized.
prev *stringPre-change source. Diffed against next via the LCS computeLineDiff.
next *stringPost-change source. Pass prev="" for a new file (all-added).
language'typescript' | 'kotlin' | 'swift'Drives the cyan-soft language pill in the header.
view'unified' | 'split''unified'Unified (one column, +/- gutter) or split (old left / new right, equal columns).
collapseContextnumber0Fold unchanged runs longer than this behind an Expand control. 0 = never fold. Unified only.

The header shows a +N / -M add/remove stat (warm status), each hunk gets an @@ -a,b +c,d @@ band, and a removed→added pair gets an intra-line word highlight on the changed span. Added = status.success wash, removed = status.error wash, context = muted, never the brand cyan, never color-alone.