feat: add configurable diff modes and split orientation
This commit is contained in:
+22
-1
@@ -141,6 +141,8 @@ module Vamp
|
||||
@labels = {}
|
||||
@diff_context_lines = 10
|
||||
@diff_expand_lines = 15
|
||||
@diff_view_mode = "split"
|
||||
@diff_split_orientation = "left_right"
|
||||
end
|
||||
|
||||
# @param path [String] relative to the configuration file
|
||||
@@ -205,6 +207,24 @@ module Vamp
|
||||
@diff_expand_lines = diff_line_count!(lines, "diff_expand_lines", 1)
|
||||
end
|
||||
|
||||
# @param mode [String] "split" or "unified"
|
||||
# @return [String]
|
||||
def diff_view_mode=(mode)
|
||||
mode = nonempty_string!(mode, "diff view mode")
|
||||
raise ArgumentError, "diff view mode must be split or unified" unless %w[split unified].include?(mode)
|
||||
@diff_view_mode = mode
|
||||
end
|
||||
|
||||
# @param orientation [String] "left_right" or "above_below"
|
||||
# @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"
|
||||
end
|
||||
@diff_split_orientation = orientation
|
||||
end
|
||||
|
||||
# @return [Module<Vamp::Core>] frozen namespace with catalog-generated Action methods
|
||||
def core
|
||||
Core
|
||||
@@ -238,7 +258,8 @@ module Vamp
|
||||
"file_explorer_view" => @file_explorer_view, "clipboard_mode" => @clipboard_mode,
|
||||
"top_bar" => @bar.top, "bottom_bar" => @bar.bottom, "labels" => @labels,
|
||||
"popup" => { "command" => @popup.command, "search" => @popup.search },
|
||||
"diff_context_lines" => @diff_context_lines, "diff_expand_lines" => @diff_expand_lines }
|
||||
"diff_context_lines" => @diff_context_lines, "diff_expand_lines" => @diff_expand_lines,
|
||||
"diff_view_mode" => @diff_view_mode, "diff_split_orientation" => @diff_split_orientation }
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
Reference in New Issue
Block a user