feat(vcs): soft-wrap long lines in the diff viewer (#2286)

The diff viewer never soft-wrapped, so a long changed line ran off the right edge. Diff panes now follow Settings › Editor › General › Soft-wrap files for the file, and the viewer's settings menu has a Use Soft Wraps checkbox that overrides it for all diffs and is remembered with the other viewer options. View › Active Editor › Soft-Wrap (editor.toggleSoftWrap) also toggles it when a diff pane has focus. Toggling reconfigures both panes in place, keeping the selection and the scroll position, including aligned split diffs.

Closes #2263

Co-authored-by: atlas-u <[email protected]>
Цей коміт міститься в:
ovra authored and GitHub committed 2026-11-09 17:03:21 +08:00
1 джерело 4bc08a1084
коміт e86134ce83
13 files changed
+388 -5

No files matched your search

+11
Переглянути файл
@@ -61,6 +61,17 @@ const FUNCS = ["parse", "format", "validate", "render", "save"].map(
const MINIFIED = Array.from({ length: 2_000 }, (_, i) => `var a${i}=f(${i},"k${i}");`).join("");
export const CASES: readonly DiffCase[] = [
{
path: "src/soft-wrap.ts",
before:
`// ${"long original text ".repeat(100)}\n` +
lines(150, (i) => `const value${i} = ${i};`) +
`// ${"old tail ".repeat(100)}\n`,
after:
`// ${"long changed text ".repeat(160)}\n` +
lines(150, (i) => `const value${i} = ${i};`) +
`// ${"new changed tail ".repeat(180)}\n`,
},
// A word edited and a comment added: one modified block (the reported case).
{ path: "src/options.ts", before: OPTIONS_BEFORE, after: OPTIONS_AFTER },
{