[ruby/reline] 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. https://github.com/ruby/reline/commit/b4279d1557
This commit is contained in:
parent
8f7e188822
commit
b3be030740
@ -53,12 +53,12 @@ module Reline
|
|||||||
:dialog_default_fg_color,
|
:dialog_default_fg_color,
|
||||||
:dialog_default_fg_color_sequence,
|
:dialog_default_fg_color_sequence,
|
||||||
:dialog_default_fg_color=,
|
:dialog_default_fg_color=,
|
||||||
:dialog_pointer_bg_color,
|
:dialog_highlight_bg_color,
|
||||||
:dialog_pointer_bg_color_sequence,
|
:dialog_highlight_bg_color_sequence,
|
||||||
:dialog_pointer_bg_color=,
|
:dialog_highlight_bg_color=,
|
||||||
:dialog_pointer_fg_color,
|
:dialog_highlight_fg_color,
|
||||||
:dialog_pointer_fg_color_sequence,
|
:dialog_highlight_fg_color_sequence,
|
||||||
:dialog_pointer_fg_color=
|
:dialog_highlight_fg_color=
|
||||||
]
|
]
|
||||||
|
|
||||||
class Core
|
class Core
|
||||||
@ -273,9 +273,9 @@ module Reline
|
|||||||
scrollbar: true,
|
scrollbar: true,
|
||||||
height: 15,
|
height: 15,
|
||||||
bg_color: config.dialog_default_bg_color_sequence,
|
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,
|
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
|
Reline::DEFAULT_DIALOG_CONTEXT = Array.new
|
||||||
@ -586,8 +586,8 @@ module Reline
|
|||||||
core.add_dialog_proc(:autocomplete, Reline::DEFAULT_DIALOG_PROC_AUTOCOMPLETE, Reline::DEFAULT_DIALOG_CONTEXT)
|
core.add_dialog_proc(:autocomplete, Reline::DEFAULT_DIALOG_PROC_AUTOCOMPLETE, Reline::DEFAULT_DIALOG_CONTEXT)
|
||||||
core.dialog_default_bg_color = :cyan
|
core.dialog_default_bg_color = :cyan
|
||||||
core.dialog_default_fg_color = :white
|
core.dialog_default_fg_color = :white
|
||||||
core.dialog_pointer_bg_color = :magenta
|
core.dialog_highlight_bg_color = :magenta
|
||||||
core.dialog_pointer_fg_color = :white
|
core.dialog_highlight_fg_color = :white
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -48,8 +48,8 @@ class Reline::Config
|
|||||||
attr_accessor :autocompletion
|
attr_accessor :autocompletion
|
||||||
attr_reader :dialog_default_bg_color_sequence,
|
attr_reader :dialog_default_bg_color_sequence,
|
||||||
:dialog_default_fg_color_sequence,
|
:dialog_default_fg_color_sequence,
|
||||||
:dialog_pointer_bg_color_sequence,
|
:dialog_highlight_bg_color_sequence,
|
||||||
:dialog_pointer_fg_color_sequence
|
:dialog_highlight_fg_color_sequence
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@additional_key_bindings = {} # from inputrc
|
@additional_key_bindings = {} # from inputrc
|
||||||
@ -76,9 +76,9 @@ class Reline::Config
|
|||||||
@autocompletion = false
|
@autocompletion = false
|
||||||
@convert_meta = true if seven_bit_encoding?(Reline::IOGate.encoding)
|
@convert_meta = true if seven_bit_encoding?(Reline::IOGate.encoding)
|
||||||
@dialog_default_bg_color_sequence = nil
|
@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_default_fg_color_sequence = nil
|
||||||
@dialog_pointer_fg_color_sequence = nil
|
@dialog_highlight_fg_color_sequence = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def reset
|
def reset
|
||||||
@ -112,12 +112,12 @@ class Reline::Config
|
|||||||
@dialog_default_fg_color_sequence = dialog_color_to_code(:fg, color)
|
@dialog_default_fg_color_sequence = dialog_color_to_code(:fg, color)
|
||||||
end
|
end
|
||||||
|
|
||||||
def dialog_pointer_bg_color=(color)
|
def dialog_highlight_bg_color=(color)
|
||||||
@dialog_pointer_bg_color_sequence = dialog_color_to_code(:bg, color)
|
@dialog_highlight_bg_color_sequence = dialog_color_to_code(:bg, color)
|
||||||
end
|
end
|
||||||
|
|
||||||
def dialog_pointer_fg_color=(color)
|
def dialog_highlight_fg_color=(color)
|
||||||
@dialog_pointer_fg_color_sequence = dialog_color_to_code(:fg, color)
|
@dialog_highlight_fg_color_sequence = dialog_color_to_code(:fg, color)
|
||||||
end
|
end
|
||||||
|
|
||||||
def dialog_default_bg_color
|
def dialog_default_bg_color
|
||||||
@ -128,12 +128,12 @@ class Reline::Config
|
|||||||
dialog_code_to_color(:fg, @dialog_default_fg_color_sequence)
|
dialog_code_to_color(:fg, @dialog_default_fg_color_sequence)
|
||||||
end
|
end
|
||||||
|
|
||||||
def dialog_pointer_bg_color
|
def dialog_highlight_bg_color
|
||||||
dialog_code_to_color(:bg, @dialog_pointer_bg_color_sequence)
|
dialog_code_to_color(:bg, @dialog_highlight_bg_color_sequence)
|
||||||
end
|
end
|
||||||
|
|
||||||
def dialog_pointer_fg_color
|
def dialog_highlight_fg_color
|
||||||
dialog_code_to_color(:fg, @dialog_pointer_fg_color_sequence)
|
dialog_code_to_color(:fg, @dialog_highlight_fg_color_sequence)
|
||||||
end
|
end
|
||||||
|
|
||||||
COLORS = [
|
COLORS = [
|
||||||
@ -399,10 +399,10 @@ class Reline::Config
|
|||||||
self.dialog_default_bg_color = value
|
self.dialog_default_bg_color = value
|
||||||
when 'dialog-default-fg-color'
|
when 'dialog-default-fg-color'
|
||||||
self.dialog_default_fg_color = value
|
self.dialog_default_fg_color = value
|
||||||
when 'dialog-pointer-bg-color'
|
when 'dialog-highlight-bg-color'
|
||||||
self.dialog_pointer_bg_color = value
|
self.dialog_highlight_bg_color = value
|
||||||
when 'dialog-pointer-fg-color'
|
when 'dialog-highlight-fg-color'
|
||||||
self.dialog_pointer_fg_color = value
|
self.dialog_highlight_fg_color = value
|
||||||
when *VARIABLE_NAMES then
|
when *VARIABLE_NAMES then
|
||||||
variable_name = :"@#{name.tr(?-, ?_)}"
|
variable_name = :"@#{name.tr(?-, ?_)}"
|
||||||
instance_variable_set(variable_name, value.nil? || value == '1' || value == 'on')
|
instance_variable_set(variable_name, value.nil? || value == '1' || value == 'on')
|
||||||
|
@ -412,15 +412,15 @@ class Reline::Config::Test < Reline::TestCase
|
|||||||
def test_dialog_configurations
|
def test_dialog_configurations
|
||||||
@config.read_lines(<<~LINES.lines)
|
@config.read_lines(<<~LINES.lines)
|
||||||
set dialog-default-bg-color white
|
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-default-fg-color cyan
|
||||||
set dialog-pointer-fg-color magenta
|
set dialog-highlight-fg-color magenta
|
||||||
LINES
|
LINES
|
||||||
|
|
||||||
assert_equal :white, @config.dialog_default_bg_color
|
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 :cyan, @config.dialog_default_fg_color
|
||||||
assert_equal :magenta, @config.dialog_pointer_fg_color
|
assert_equal :magenta, @config.dialog_highlight_fg_color
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -50,8 +50,8 @@ class Reline::Test < Reline::TestCase
|
|||||||
# defaults
|
# defaults
|
||||||
assert_equal(:cyan, Reline.dialog_default_bg_color)
|
assert_equal(:cyan, Reline.dialog_default_bg_color)
|
||||||
assert_equal(:white, Reline.dialog_default_fg_color)
|
assert_equal(:white, Reline.dialog_default_fg_color)
|
||||||
assert_equal(:magenta, Reline.dialog_pointer_bg_color)
|
assert_equal(:magenta, Reline.dialog_highlight_bg_color)
|
||||||
assert_equal(:white, Reline.dialog_pointer_fg_color)
|
assert_equal(:white, Reline.dialog_highlight_fg_color)
|
||||||
|
|
||||||
Reline.dialog_default_bg_color = :black
|
Reline.dialog_default_bg_color = :black
|
||||||
assert_equal(:black, Reline.dialog_default_bg_color)
|
assert_equal(:black, Reline.dialog_default_bg_color)
|
||||||
@ -61,17 +61,17 @@ class Reline::Test < Reline::TestCase
|
|||||||
assert_equal(:white, Reline.dialog_default_fg_color)
|
assert_equal(:white, Reline.dialog_default_fg_color)
|
||||||
assert_equal(37, Reline.dialog_default_fg_color_sequence)
|
assert_equal(37, Reline.dialog_default_fg_color_sequence)
|
||||||
|
|
||||||
Reline.dialog_pointer_bg_color = :white
|
Reline.dialog_highlight_bg_color = :white
|
||||||
assert_equal(:white, Reline.dialog_pointer_bg_color)
|
assert_equal(:white, Reline.dialog_highlight_bg_color)
|
||||||
assert_equal(47, Reline.dialog_pointer_bg_color_sequence)
|
assert_equal(47, Reline.dialog_highlight_bg_color_sequence)
|
||||||
|
|
||||||
Reline.dialog_pointer_fg_color = :black
|
Reline.dialog_highlight_fg_color = :black
|
||||||
assert_equal(:black, Reline.dialog_pointer_fg_color)
|
assert_equal(:black, Reline.dialog_highlight_fg_color)
|
||||||
assert_equal(30, Reline.dialog_pointer_fg_color_sequence)
|
assert_equal(30, Reline.dialog_highlight_fg_color_sequence)
|
||||||
|
|
||||||
# test value validation
|
# test value validation
|
||||||
assert_raise(ArgumentError) do
|
assert_raise(ArgumentError) do
|
||||||
Reline.dialog_pointer_fg_color = :foo
|
Reline.dialog_highlight_fg_color = :foo
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user