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

+19
Переглянути файл
@@ -395,6 +395,7 @@ pub fn spec(os: Os) -> Vec<Entry> {
sub("statusBarWidgets", "Status Bar Widgets", vec![Entry::Dynamic(DYNAMIC_STATUS_BAR_WIDGETS)]),
],
),
sub("activeEditor", "Active Editor", vec![act("editor.toggleSoftWrap", "Soft-Wrap")]),
SEP,
act("code.quickDefinition", "Quick Definition"),
act("code.quickTypeDefinition", "Quick Type Definition"),
@@ -1652,6 +1653,24 @@ mod tests {
}
}
#[test]
fn soft_wrap_is_available_under_view_active_editor_on_every_os() {
for os in ALL_OS {
let menus = spec(os);
let Entry::Submenu { children: view, .. } =
menus.iter().find(|e| matches!(e, Entry::Submenu { id: "view", .. })).unwrap()
else {
panic!("View menu missing")
};
let Entry::Submenu { children: active, .. } =
view.iter().find(|e| matches!(e, Entry::Submenu { id: "activeEditor", .. })).unwrap()
else {
panic!("Active Editor menu missing")
};
assert!(action_ids(active).contains(&"editor.toggleSoftWrap"), "{os:?}");
}
}
#[test]
fn unchanged_menu_config_is_not_rebuilt() {
let state = MenuState::default();