From b4279d15576195da88864422f8a8893c4347e21e Mon Sep 17 00:00:00 2001 From: st0012 Date: Thu, 21 Jul 2022 11:15:39 +0100 Subject: [PATCH] Rename dialog_pointer_* to dialog_highlight_* "Pointer" is not what we usually use to describe a selected item. "Highlight" is a more common word for the scenario so we should use it instead. --- lib/reline.rb | 20 ++++++++++---------- lib/reline/config.rb | 32 ++++++++++++++++---------------- test/reline/test_config.rb | 8 ++++---- test/reline/test_reline.rb | 18 +++++++++--------- 4 files changed, 39 insertions(+), 39 deletions(-) diff --git a/lib/reline.rb b/lib/reline.rb index 9de04a95b3..0487232a0d 100644 --- a/lib/reline.rb +++ b/lib/reline.rb @@ -53,12 +53,12 @@ def match?(other) :dialog_default_fg_color, :dialog_default_fg_color_sequence, :dialog_default_fg_color=, - :dialog_pointer_bg_color, - :dialog_pointer_bg_color_sequence, - :dialog_pointer_bg_color=, - :dialog_pointer_fg_color, - :dialog_pointer_fg_color_sequence, - :dialog_pointer_fg_color= + :dialog_highlight_bg_color, + :dialog_highlight_bg_color_sequence, + :dialog_highlight_bg_color=, + :dialog_highlight_fg_color, + :dialog_highlight_fg_color_sequence, + :dialog_highlight_fg_color= ] class Core @@ -273,9 +273,9 @@ def get_screen_size scrollbar: true, height: 15, bg_color: config.dialog_default_bg_color_sequence, - pointer_bg_color: config.dialog_pointer_bg_color_sequence, + pointer_bg_color: config.dialog_highlight_bg_color_sequence, fg_color: config.dialog_default_fg_color_sequence, - pointer_fg_color: config.dialog_pointer_fg_color_sequence + pointer_fg_color: config.dialog_highlight_fg_color_sequence ) } Reline::DEFAULT_DIALOG_CONTEXT = Array.new @@ -586,8 +586,8 @@ def self.core core.add_dialog_proc(:autocomplete, Reline::DEFAULT_DIALOG_PROC_AUTOCOMPLETE, Reline::DEFAULT_DIALOG_CONTEXT) core.dialog_default_bg_color = :cyan core.dialog_default_fg_color = :white - core.dialog_pointer_bg_color = :magenta - core.dialog_pointer_fg_color = :white + core.dialog_highlight_bg_color = :magenta + core.dialog_highlight_fg_color = :white } end diff --git a/lib/reline/config.rb b/lib/reline/config.rb index cef7735bdb..ffd1765e4f 100644 --- a/lib/reline/config.rb +++ b/lib/reline/config.rb @@ -48,8 +48,8 @@ class InvalidInputrc < RuntimeError attr_accessor :autocompletion attr_reader :dialog_default_bg_color_sequence, :dialog_default_fg_color_sequence, - :dialog_pointer_bg_color_sequence, - :dialog_pointer_fg_color_sequence + :dialog_highlight_bg_color_sequence, + :dialog_highlight_fg_color_sequence def initialize @additional_key_bindings = {} # from inputrc @@ -76,9 +76,9 @@ def initialize @autocompletion = false @convert_meta = true if seven_bit_encoding?(Reline::IOGate.encoding) @dialog_default_bg_color_sequence = nil - @dialog_pointer_bg_color_sequence = nil + @dialog_highlight_bg_color_sequence = nil @dialog_default_fg_color_sequence = nil - @dialog_pointer_fg_color_sequence = nil + @dialog_highlight_fg_color_sequence = nil end def reset @@ -112,12 +112,12 @@ def dialog_default_fg_color=(color) @dialog_default_fg_color_sequence = dialog_color_to_code(:fg, color) end - def dialog_pointer_bg_color=(color) - @dialog_pointer_bg_color_sequence = dialog_color_to_code(:bg, color) + def dialog_highlight_bg_color=(color) + @dialog_highlight_bg_color_sequence = dialog_color_to_code(:bg, color) end - def dialog_pointer_fg_color=(color) - @dialog_pointer_fg_color_sequence = dialog_color_to_code(:fg, color) + def dialog_highlight_fg_color=(color) + @dialog_highlight_fg_color_sequence = dialog_color_to_code(:fg, color) end def dialog_default_bg_color @@ -128,12 +128,12 @@ def dialog_default_fg_color dialog_code_to_color(:fg, @dialog_default_fg_color_sequence) end - def dialog_pointer_bg_color - dialog_code_to_color(:bg, @dialog_pointer_bg_color_sequence) + def dialog_highlight_bg_color + dialog_code_to_color(:bg, @dialog_highlight_bg_color_sequence) end - def dialog_pointer_fg_color - dialog_code_to_color(:fg, @dialog_pointer_fg_color_sequence) + def dialog_highlight_fg_color + dialog_code_to_color(:fg, @dialog_highlight_fg_color_sequence) end COLORS = [ @@ -399,10 +399,10 @@ def bind_variable(name, value) self.dialog_default_bg_color = value when 'dialog-default-fg-color' self.dialog_default_fg_color = value - when 'dialog-pointer-bg-color' - self.dialog_pointer_bg_color = value - when 'dialog-pointer-fg-color' - self.dialog_pointer_fg_color = value + when 'dialog-highlight-bg-color' + self.dialog_highlight_bg_color = value + when 'dialog-highlight-fg-color' + self.dialog_highlight_fg_color = value when *VARIABLE_NAMES then variable_name = :"@#{name.tr(?-, ?_)}" instance_variable_set(variable_name, value.nil? || value == '1' || value == 'on') diff --git a/test/reline/test_config.rb b/test/reline/test_config.rb index eaee2fd580..6b4dca0b28 100644 --- a/test/reline/test_config.rb +++ b/test/reline/test_config.rb @@ -412,15 +412,15 @@ def test_relative_xdg_config_home def test_dialog_configurations @config.read_lines(<<~LINES.lines) set dialog-default-bg-color white - set dialog-pointer-bg-color black + set dialog-highlight-bg-color black set dialog-default-fg-color cyan - set dialog-pointer-fg-color magenta + set dialog-highlight-fg-color magenta LINES assert_equal :white, @config.dialog_default_bg_color - assert_equal :black, @config.dialog_pointer_bg_color + assert_equal :black, @config.dialog_highlight_bg_color assert_equal :cyan, @config.dialog_default_fg_color - assert_equal :magenta, @config.dialog_pointer_fg_color + assert_equal :magenta, @config.dialog_highlight_fg_color end end diff --git a/test/reline/test_reline.rb b/test/reline/test_reline.rb index 6717914c64..8828e41985 100644 --- a/test/reline/test_reline.rb +++ b/test/reline/test_reline.rb @@ -50,8 +50,8 @@ def test_dialog_color_configuration # defaults assert_equal(:cyan, Reline.dialog_default_bg_color) assert_equal(:white, Reline.dialog_default_fg_color) - assert_equal(:magenta, Reline.dialog_pointer_bg_color) - assert_equal(:white, Reline.dialog_pointer_fg_color) + assert_equal(:magenta, Reline.dialog_highlight_bg_color) + assert_equal(:white, Reline.dialog_highlight_fg_color) Reline.dialog_default_bg_color = :black assert_equal(:black, Reline.dialog_default_bg_color) @@ -61,17 +61,17 @@ def test_dialog_color_configuration assert_equal(:white, Reline.dialog_default_fg_color) assert_equal(37, Reline.dialog_default_fg_color_sequence) - Reline.dialog_pointer_bg_color = :white - assert_equal(:white, Reline.dialog_pointer_bg_color) - assert_equal(47, Reline.dialog_pointer_bg_color_sequence) + Reline.dialog_highlight_bg_color = :white + assert_equal(:white, Reline.dialog_highlight_bg_color) + assert_equal(47, Reline.dialog_highlight_bg_color_sequence) - Reline.dialog_pointer_fg_color = :black - assert_equal(:black, Reline.dialog_pointer_fg_color) - assert_equal(30, Reline.dialog_pointer_fg_color_sequence) + Reline.dialog_highlight_fg_color = :black + assert_equal(:black, Reline.dialog_highlight_fg_color) + assert_equal(30, Reline.dialog_highlight_fg_color_sequence) # test value validation assert_raise(ArgumentError) do - Reline.dialog_pointer_fg_color = :foo + Reline.dialog_highlight_fg_color = :foo end end