feat: add configurable whitespace markers
This commit is contained in:
@@ -143,6 +143,7 @@ module Vamp
|
||||
@labels = {}
|
||||
@scroll_distance = 0
|
||||
@highlight_trailing_whitespace = false
|
||||
@whitespace_characters = {}
|
||||
@diff_context_lines = 10
|
||||
@diff_expand_lines = 15
|
||||
@diff_view_mode = "split"
|
||||
@@ -230,6 +231,19 @@ module Vamp
|
||||
@highlight_trailing_whitespace = enabled
|
||||
end
|
||||
|
||||
# @param characters [Hash{String => String}] whitespace character to single-cell marker
|
||||
# @return [Hash{String => String}]
|
||||
def whitespace_characters=(characters)
|
||||
raise TypeError, "whitespace_characters must be a Hash" unless characters.is_a?(Hash)
|
||||
|
||||
characters.each do |whitespace, marker|
|
||||
unless [whitespace, marker].all? { |value| value.is_a?(String) && value.length == 1 }
|
||||
raise TypeError, "whitespace_characters keys and values must be single-character Strings"
|
||||
end
|
||||
end
|
||||
@whitespace_characters = characters.dup
|
||||
end
|
||||
|
||||
# @param lines [Integer] nonnegative context lines around each diff change
|
||||
# @return [Integer]
|
||||
def diff_context_lines=(lines)
|
||||
@@ -303,6 +317,7 @@ module Vamp
|
||||
"git_gutter" => @git_gutter,
|
||||
"scroll_distance" => @scroll_distance,
|
||||
"highlight_trailing_whitespace" => @highlight_trailing_whitespace,
|
||||
"whitespace_characters" => @whitespace_characters,
|
||||
"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,
|
||||
|
||||
Reference in New Issue
Block a user