diff --git a/docs/configuration.md b/docs/configuration.md index 451820c..a94130f 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -19,7 +19,7 @@ Vamp.configure do |config| config.diff_context_lines = 10 config.diff_expand_lines = 15 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+l", config.core.right, mode: config.modes.tree 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_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 config.bind "leader v", config.core.diff.view.toggle diff --git a/docs/editing.md b/docs/editing.md index 6c2d20e..2363630 100644 --- a/docs/editing.md +++ b/docs/editing.md @@ -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. -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. diff --git a/examples/config.rb b/examples/config.rb index a1d6470..63b5124 100644 --- a/examples/config.rb +++ b/examples/config.rb @@ -8,7 +8,7 @@ Vamp.configure do |config| config.file_explorer_view = "tree" config.file_picker_view = "tree" 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.search = { anchor: :center } # Status above, tabs and live battery below; either bar accepts all segments. diff --git a/src/main.rs b/src/main.rs index 0cf0be1..4dbfe1e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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 diff --git a/src/panes.rs b/src/panes.rs index f36d727..89b9164 100644 --- a/src/panes.rs +++ b/src/panes.rs @@ -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, } diff --git a/src/ruby.rs b/src/ruby.rs index 0fe31a4..fba05f0 100644 --- a/src/ruby.rs +++ b/src/ruby.rs @@ -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::(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::(frame.clone()).unwrap() else { diff --git a/src/ruby_config.rb b/src/ruby_config.rb index 1bf45b5..08c9b3d 100644 --- a/src/ruby_config.rb +++ b/src/ruby_config.rb @@ -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 diff --git a/src/session.rs b/src/session.rs index b7db183..5b08cbf 100644 --- a/src/session.rs +++ b/src/session.rs @@ -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",