refactor: name diff orientations vertical and horizontal
This commit is contained in:
+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
|
||||
Normal [/] explicitly expands context; Insert brackets remain literal text
|
||||
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
|
||||
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
|
||||
|
||||
+1
-2
@@ -1,12 +1,11 @@
|
||||
//! Frontend-independent binary pane layout and spatial focus navigation.
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum SplitAxis {
|
||||
/// Above/below.
|
||||
#[serde(rename = "above_below")]
|
||||
Horizontal,
|
||||
/// Left/right.
|
||||
#[serde(rename = "left_right")]
|
||||
Vertical,
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -1204,9 +1204,9 @@ end
|
||||
assert!(load_config(&path).unwrap_err().contains(error), "{value}");
|
||||
}
|
||||
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":[],"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":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":[],"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":"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":"vertical"}"#,
|
||||
] {
|
||||
assert!(serde_json::from_str::<Response>(frame).is_err(), "{frame}");
|
||||
}
|
||||
@@ -1425,7 +1425,7 @@ end
|
||||
"top_bar": {}, "bottom_bar": {}, "labels": {},
|
||||
"popup": {"command": {}, "search": {}},
|
||||
"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 value in [
|
||||
@@ -1840,7 +1840,7 @@ end"#,
|
||||
"top_bar": {}, "bottom_bar": {}, "labels": {},
|
||||
"popup": {"command": {}, "search": {}},
|
||||
"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()
|
||||
else {
|
||||
|
||||
+4
-4
@@ -142,7 +142,7 @@ module Vamp
|
||||
@diff_context_lines = 10
|
||||
@diff_expand_lines = 15
|
||||
@diff_view_mode = "split"
|
||||
@diff_split_orientation = "left_right"
|
||||
@diff_split_orientation = "vertical"
|
||||
end
|
||||
|
||||
# @param path [String] relative to the configuration file
|
||||
@@ -215,12 +215,12 @@ module Vamp
|
||||
@diff_view_mode = mode
|
||||
end
|
||||
|
||||
# @param orientation [String] "left_right" or "above_below"
|
||||
# @param orientation [String] "vertical" or "horizontal"
|
||||
# @return [String]
|
||||
def diff_split_orientation=(orientation)
|
||||
orientation = nonempty_string!(orientation, "diff split orientation")
|
||||
unless %w[left_right above_below].include?(orientation)
|
||||
raise ArgumentError, "diff split orientation must be left_right or above_below"
|
||||
unless %w[vertical horizontal].include?(orientation)
|
||||
raise ArgumentError, "diff split orientation must be vertical or horizontal"
|
||||
end
|
||||
@diff_split_orientation = orientation
|
||||
end
|
||||
|
||||
+12
-3
@@ -1824,16 +1824,17 @@ end
|
||||
for (mode, orientation, expected_mode, expected_axis) in [
|
||||
(
|
||||
"unified",
|
||||
"above_below",
|
||||
"horizontal",
|
||||
ViewMode::Unified,
|
||||
SplitAxis::Horizontal,
|
||||
),
|
||||
(
|
||||
"split",
|
||||
"above_below",
|
||||
"horizontal",
|
||||
ViewMode::Split,
|
||||
SplitAxis::Horizontal,
|
||||
),
|
||||
("split", "vertical", ViewMode::Split, SplitAxis::Vertical),
|
||||
] {
|
||||
let mut session = fixture.open(&format!(
|
||||
r#"Vamp.configure do |config|
|
||||
@@ -3055,7 +3056,15 @@ end
|
||||
),
|
||||
(
|
||||
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",
|
||||
|
||||
Reference in New Issue
Block a user