refactor: name diff orientations vertical and horizontal
This commit is contained in:
@@ -19,7 +19,7 @@ Vamp.configure do |config|
|
|||||||
config.diff_context_lines = 10
|
config.diff_context_lines = 10
|
||||||
config.diff_expand_lines = 15
|
config.diff_expand_lines = 15
|
||||||
config.diff_view_mode = "split" # or "unified"
|
config.diff_view_mode = "split" # or "unified"
|
||||||
config.diff_split_orientation = "left_right" # or "above_below"
|
config.diff_split_orientation = "vertical" # or "horizontal"
|
||||||
config.bind "ctrl+h", config.core.left, mode: config.modes.tree
|
config.bind "ctrl+h", config.core.left, mode: config.modes.tree
|
||||||
config.bind "ctrl+l", config.core.right, mode: config.modes.tree
|
config.bind "ctrl+l", config.core.right, mode: config.modes.tree
|
||||||
config.plugin "plugins/greeting.rb"
|
config.plugin "plugins/greeting.rb"
|
||||||
@@ -46,7 +46,7 @@ Plugin paths resolve relative to the config file, not the shell's working direct
|
|||||||
|
|
||||||
`config.diff_context_lines = 10` sets how many unchanged aligned lines appear above and below each diff change; it defaults to `10` and accepts nonnegative integers, including `0` for changes only. `config.diff_expand_lines = 15` sets how many additional lines each directional expansion reveals per keypress; it defaults to `15` and accepts positive integers. Both are bounded by the platform's Rust `usize` maximum (`18446744073709551615` on 64-bit systems). Floats, strings, booleans, negative or oversized values, and a zero expansion step reject the whole Ruby configuration.
|
`config.diff_context_lines = 10` sets how many unchanged aligned lines appear above and below each diff change; it defaults to `10` and accepts nonnegative integers, including `0` for changes only. `config.diff_expand_lines = 15` sets how many additional lines each directional expansion reveals per keypress; it defaults to `15` and accepts positive integers. Both are bounded by the platform's Rust `usize` maximum (`18446744073709551615` on 64-bit systems). Floats, strings, booleans, negative or oversized values, and a zero expansion step reject the whole Ruby configuration.
|
||||||
|
|
||||||
`config.diff_view_mode` selects the initial view for each new comparison: `"split"` (default) or `"unified"`. `config.diff_split_orientation` selects `"left_right"` (default) or `"above_below"` for split views. Invalid values reject the configuration. Normal-mode **Space v** cycles split/unified; **Space s** flips split orientation. These controls affect the current comparison, not startup defaults, and retain their choices across file switches and tabs. Orientation changes apply only in split view.
|
`config.diff_view_mode` selects the initial view for each new comparison: `"split"` (default) or `"unified"`. `config.diff_split_orientation` selects `"vertical"` (left/right, default) or `"horizontal"` (above/below) for split views. Invalid values reject the configuration. Normal-mode **Space v** cycles split/unified; **Space s** flips split orientation. These controls affect the current comparison, not startup defaults, and retain their choices across file switches and tabs. Orientation changes apply only in split view.
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
config.bind "leader v", config.core.diff.view.toggle
|
config.bind "leader v", config.core.diff.view.toggle
|
||||||
|
|||||||
+1
-1
@@ -329,7 +329,7 @@ Comparison discovery builds the changed-path/status catalog first. File text, no
|
|||||||
|
|
||||||
The changed-file explorer is **docked on the right**. In the default split layout, modified files show Before on the left and After on the right. Added files show only After, using the full text workspace; deleted files show only Before. Rename-only files show one empty pane, with the old and new paths in the explorer; renames with text or final-newline changes retain both source sides. Before and historical/remote After snapshots are read-only. Selecting **Working checkout** as After binds eligible regular UTF-8 files to normal editor buffers, reusing already-open dirty buffers and their undo history. Editable After supports native edits, completion, undo/redo, and `:w`. Removed files, rename-only files, binary files, symlinks, and submodules remain read-only. Closing the diff keeps its buffers and unsaved edits.
|
The changed-file explorer is **docked on the right**. In the default split layout, modified files show Before on the left and After on the right. Added files show only After, using the full text workspace; deleted files show only Before. Rename-only files show one empty pane, with the old and new paths in the explorer; renames with text or final-newline changes retain both source sides. Before and historical/remote After snapshots are read-only. Selecting **Working checkout** as After binds eligible regular UTF-8 files to normal editor buffers, reusing already-open dirty buffers and their undo history. Editable After supports native edits, completion, undo/redo, and `:w`. Removed files, rename-only files, binary files, symlinks, and submodules remain read-only. Closing the diff keeps its buffers and unsaved edits.
|
||||||
|
|
||||||
Comparisons start in **split, left/right** view by default. In Normal mode, **Space v** cycles split/unified; **Space s** switches a split between left/right and above/below (Before above, After below). Canonical commands are `:diff.view.toggle` and `:diff.orientation.toggle`; both are available in the palette and as remappable `config.core.diff.view.toggle` / `config.core.diff.orientation.toggle` actions. Configure new-comparison defaults with `config.diff_view_mode = "split"` or `"unified"` and `config.diff_split_orientation = "left_right"` or `"above_below"`. Current choices survive file and tab switches; closing and reopening uses the configured defaults. Orientation stays unchanged while unified is active.
|
Comparisons start in **split, vertical (left/right)** view by default. In Normal mode, **Space v** cycles split/unified; **Space s** switches a split between vertical (left/right) and horizontal (above/below, Before above After). Canonical commands are `:diff.view.toggle` and `:diff.orientation.toggle`; both are available in the palette and as remappable `config.core.diff.view.toggle` / `config.core.diff.orientation.toggle` actions. Configure new-comparison defaults with `config.diff_view_mode = "split"` or `"unified"` and `config.diff_split_orientation = "vertical"` or `"horizontal"`. Current choices survive file and tab switches; closing and reopening uses the configured defaults. Orientation stays unchanged while unified is active.
|
||||||
|
|
||||||
**Unified** uses one full-width text pane with both original line-number columns: context appears once, then each changed run shows removed (`-`) lines followed by added (`+`) lines, without alignment holes. Tab/Shift+Tab still switches logical Before/After focus, preserving native source coordinates, read-only protection, and Working After editing. The border shows the combined revisions and the focused side's editability. Word wrap, syntax/semantic and character highlighting, search, selections, excerpt expansion, and wheel scrolling work in either view.
|
**Unified** uses one full-width text pane with both original line-number columns: context appears once, then each changed run shows removed (`-`) lines followed by added (`+`) lines, without alignment holes. Tab/Shift+Tab still switches logical Before/After focus, preserving native source coordinates, read-only protection, and Working After editing. The border shows the combined revisions and the focused side's editability. Word wrap, syntax/semantic and character highlighting, search, selections, excerpt expansion, and wheel scrolling work in either view.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@ Vamp.configure do |config|
|
|||||||
config.file_explorer_view = "tree"
|
config.file_explorer_view = "tree"
|
||||||
config.file_picker_view = "tree"
|
config.file_picker_view = "tree"
|
||||||
config.diff_view_mode = "split" # or "unified"
|
config.diff_view_mode = "split" # or "unified"
|
||||||
config.diff_split_orientation = "left_right" # or "above_below"
|
config.diff_split_orientation = "vertical" # or "horizontal"
|
||||||
# config.popup.command = { anchor: :bottom_left }
|
# config.popup.command = { anchor: :bottom_left }
|
||||||
# config.popup.search = { anchor: :center }
|
# config.popup.search = { anchor: :center }
|
||||||
# Status above, tabs and live battery below; either bar accepts all segments.
|
# Status above, tabs and live battery below; either bar accepts all segments.
|
||||||
|
|||||||
+1
-1
@@ -70,7 +70,7 @@ Diff: :diff (Normal); choose Before then After; Working checkout After edits liv
|
|||||||
Selector queries own printable keys, including :; text navigation skips omitted lines
|
Selector queries own printable keys, including :; text navigation skips omitted lines
|
||||||
Normal [/] explicitly expands context; Insert brackets remain literal text
|
Normal [/] explicitly expands context; Insert brackets remain literal text
|
||||||
Normal Space v cycles split/unified; Space s flips left/right vs above/below split
|
Normal Space v cycles split/unified; Space s flips left/right vs above/below split
|
||||||
Defaults: config.diff_view_mode = \"split\"; config.diff_split_orientation = \"left_right\"
|
Defaults: config.diff_view_mode = \"split\"; config.diff_split_orientation = \"vertical\"
|
||||||
Esc closes Before/After selectors; :diff.close exits an opened comparison explicitly
|
Esc closes Before/After selectors; :diff.close exits an opened comparison explicitly
|
||||||
Remote refs/history load into temporary comparison repos without changing active refs/checkout
|
Remote refs/history load into temporary comparison repos without changing active refs/checkout
|
||||||
Changed files: normal picker/explorer bindings, Ctrl+w close; A/M/D/R status and rename paths
|
Changed files: normal picker/explorer bindings, Ctrl+w close; A/M/D/R status and rename paths
|
||||||
|
|||||||
+1
-2
@@ -1,12 +1,11 @@
|
|||||||
//! Frontend-independent binary pane layout and spatial focus navigation.
|
//! Frontend-independent binary pane layout and spatial focus navigation.
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Deserialize)]
|
#[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Deserialize)]
|
||||||
|
#[serde(rename_all = "snake_case")]
|
||||||
pub enum SplitAxis {
|
pub enum SplitAxis {
|
||||||
/// Above/below.
|
/// Above/below.
|
||||||
#[serde(rename = "above_below")]
|
|
||||||
Horizontal,
|
Horizontal,
|
||||||
/// Left/right.
|
/// Left/right.
|
||||||
#[serde(rename = "left_right")]
|
|
||||||
Vertical,
|
Vertical,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -1204,9 +1204,9 @@ end
|
|||||||
assert!(load_config(&path).unwrap_err().contains(error), "{value}");
|
assert!(load_config(&path).unwrap_err().contains(error), "{value}");
|
||||||
}
|
}
|
||||||
for frame in [
|
for frame in [
|
||||||
r#"{"type":"config","version":1,"plugins":[],"lsp":{},"bindings":[],"file_explorer_side":"right","file_picker_view":"list","file_explorer_view":"tree","clipboard_mode":"system","top_bar":{},"bottom_bar":{},"popup":{"command":{},"search":{}},"labels":{},"diff_context_lines":10,"diff_expand_lines":15,"diff_view_mode":"split","diff_split_orientation":"left_right"}"#,
|
r#"{"type":"config","version":1,"plugins":[],"lsp":{},"bindings":[],"file_explorer_side":"right","file_picker_view":"list","file_explorer_view":"tree","clipboard_mode":"system","top_bar":{},"bottom_bar":{},"popup":{"command":{},"search":{}},"labels":{},"diff_context_lines":10,"diff_expand_lines":15,"diff_view_mode":"split","diff_split_orientation":"vertical"}"#,
|
||||||
r#"{"type":"config","version":1,"plugins":[],"lsp":{},"bindings":[],"leader":null,"file_explorer_side":"right","file_picker_view":"list","file_explorer_view":"tree","clipboard_mode":"system","top_bar":{},"bottom_bar":{},"popup":{"command":{},"search":{}},"labels":{},"diff_context_lines":10,"diff_expand_lines":15,"diff_view_mode":"split","diff_split_orientation":"left_right"}"#,
|
r#"{"type":"config","version":1,"plugins":[],"lsp":{},"bindings":[],"leader":null,"file_explorer_side":"right","file_picker_view":"list","file_explorer_view":"tree","clipboard_mode":"system","top_bar":{},"bottom_bar":{},"popup":{"command":{},"search":{}},"labels":{},"diff_context_lines":10,"diff_expand_lines":15,"diff_view_mode":"split","diff_split_orientation":"vertical"}"#,
|
||||||
r#"{"type":"config","version":1,"plugins":[],"lsp":{},"bindings":[],"leader":7,"file_explorer_side":"right","file_picker_view":"list","file_explorer_view":"tree","clipboard_mode":"system","top_bar":{},"bottom_bar":{},"popup":{"command":{},"search":{}},"labels":{},"diff_context_lines":10,"diff_expand_lines":15,"diff_view_mode":"split","diff_split_orientation":"left_right"}"#,
|
r#"{"type":"config","version":1,"plugins":[],"lsp":{},"bindings":[],"leader":7,"file_explorer_side":"right","file_picker_view":"list","file_explorer_view":"tree","clipboard_mode":"system","top_bar":{},"bottom_bar":{},"popup":{"command":{},"search":{}},"labels":{},"diff_context_lines":10,"diff_expand_lines":15,"diff_view_mode":"split","diff_split_orientation":"vertical"}"#,
|
||||||
] {
|
] {
|
||||||
assert!(serde_json::from_str::<Response>(frame).is_err(), "{frame}");
|
assert!(serde_json::from_str::<Response>(frame).is_err(), "{frame}");
|
||||||
}
|
}
|
||||||
@@ -1425,7 +1425,7 @@ end
|
|||||||
"top_bar": {}, "bottom_bar": {}, "labels": {},
|
"top_bar": {}, "bottom_bar": {}, "labels": {},
|
||||||
"popup": {"command": {}, "search": {}},
|
"popup": {"command": {}, "search": {}},
|
||||||
"clipboard_mode": "system", "diff_context_lines": 0, "diff_expand_lines": 7,
|
"clipboard_mode": "system", "diff_context_lines": 0, "diff_expand_lines": 7,
|
||||||
"diff_view_mode": "split", "diff_split_orientation": "left_right"
|
"diff_view_mode": "split", "diff_split_orientation": "vertical"
|
||||||
});
|
});
|
||||||
for setting in ["diff_context_lines", "diff_expand_lines"] {
|
for setting in ["diff_context_lines", "diff_expand_lines"] {
|
||||||
for value in [
|
for value in [
|
||||||
@@ -1840,7 +1840,7 @@ end"#,
|
|||||||
"top_bar": {}, "bottom_bar": {}, "labels": {},
|
"top_bar": {}, "bottom_bar": {}, "labels": {},
|
||||||
"popup": {"command": {}, "search": {}},
|
"popup": {"command": {}, "search": {}},
|
||||||
"clipboard_mode": "system", "diff_context_lines": 10, "diff_expand_lines": 15,
|
"clipboard_mode": "system", "diff_context_lines": 10, "diff_expand_lines": 15,
|
||||||
"diff_view_mode": "split", "diff_split_orientation": "left_right"
|
"diff_view_mode": "split", "diff_split_orientation": "vertical"
|
||||||
});
|
});
|
||||||
let Response::Config(config) = serde_json::from_value::<Response>(frame.clone()).unwrap()
|
let Response::Config(config) = serde_json::from_value::<Response>(frame.clone()).unwrap()
|
||||||
else {
|
else {
|
||||||
|
|||||||
+4
-4
@@ -142,7 +142,7 @@ module Vamp
|
|||||||
@diff_context_lines = 10
|
@diff_context_lines = 10
|
||||||
@diff_expand_lines = 15
|
@diff_expand_lines = 15
|
||||||
@diff_view_mode = "split"
|
@diff_view_mode = "split"
|
||||||
@diff_split_orientation = "left_right"
|
@diff_split_orientation = "vertical"
|
||||||
end
|
end
|
||||||
|
|
||||||
# @param path [String] relative to the configuration file
|
# @param path [String] relative to the configuration file
|
||||||
@@ -215,12 +215,12 @@ module Vamp
|
|||||||
@diff_view_mode = mode
|
@diff_view_mode = mode
|
||||||
end
|
end
|
||||||
|
|
||||||
# @param orientation [String] "left_right" or "above_below"
|
# @param orientation [String] "vertical" or "horizontal"
|
||||||
# @return [String]
|
# @return [String]
|
||||||
def diff_split_orientation=(orientation)
|
def diff_split_orientation=(orientation)
|
||||||
orientation = nonempty_string!(orientation, "diff split orientation")
|
orientation = nonempty_string!(orientation, "diff split orientation")
|
||||||
unless %w[left_right above_below].include?(orientation)
|
unless %w[vertical horizontal].include?(orientation)
|
||||||
raise ArgumentError, "diff split orientation must be left_right or above_below"
|
raise ArgumentError, "diff split orientation must be vertical or horizontal"
|
||||||
end
|
end
|
||||||
@diff_split_orientation = orientation
|
@diff_split_orientation = orientation
|
||||||
end
|
end
|
||||||
|
|||||||
+12
-3
@@ -1824,16 +1824,17 @@ end
|
|||||||
for (mode, orientation, expected_mode, expected_axis) in [
|
for (mode, orientation, expected_mode, expected_axis) in [
|
||||||
(
|
(
|
||||||
"unified",
|
"unified",
|
||||||
"above_below",
|
"horizontal",
|
||||||
ViewMode::Unified,
|
ViewMode::Unified,
|
||||||
SplitAxis::Horizontal,
|
SplitAxis::Horizontal,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"split",
|
"split",
|
||||||
"above_below",
|
"horizontal",
|
||||||
ViewMode::Split,
|
ViewMode::Split,
|
||||||
SplitAxis::Horizontal,
|
SplitAxis::Horizontal,
|
||||||
),
|
),
|
||||||
|
("split", "vertical", ViewMode::Split, SplitAxis::Vertical),
|
||||||
] {
|
] {
|
||||||
let mut session = fixture.open(&format!(
|
let mut session = fixture.open(&format!(
|
||||||
r#"Vamp.configure do |config|
|
r#"Vamp.configure do |config|
|
||||||
@@ -3055,7 +3056,15 @@ end
|
|||||||
),
|
),
|
||||||
(
|
(
|
||||||
r#"config.diff_split_orientation = "invalid""#,
|
r#"config.diff_split_orientation = "invalid""#,
|
||||||
"diff split orientation must be left_right or above_below",
|
"diff split orientation must be vertical or horizontal",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
r#"config.diff_split_orientation = "left_right""#,
|
||||||
|
"diff split orientation must be vertical or horizontal",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
r#"config.diff_split_orientation = "above_below""#,
|
||||||
|
"diff split orientation must be vertical or horizontal",
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"config.diff_view_mode = 7",
|
"config.diff_view_mode = 7",
|
||||||
|
|||||||
Reference in New Issue
Block a user