Skip to content

Commit b4279d1

Browse files
committed
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.
1 parent b6ffa17 commit b4279d1

File tree

4 files changed

+39
-39
lines changed

4 files changed

+39
-39
lines changed

lib/reline.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ def match?(other)
5353
:dialog_default_fg_color,
5454
:dialog_default_fg_color_sequence,
5555
:dialog_default_fg_color=,
56-
:dialog_pointer_bg_color,
57-
:dialog_pointer_bg_color_sequence,
58-
:dialog_pointer_bg_color=,
59-
:dialog_pointer_fg_color,
60-
:dialog_pointer_fg_color_sequence,
61-
:dialog_pointer_fg_color=
56+
:dialog_highlight_bg_color,
57+
:dialog_highlight_bg_color_sequence,
58+
:dialog_highlight_bg_color=,
59+
:dialog_highlight_fg_color,
60+
:dialog_highlight_fg_color_sequence,
61+
:dialog_highlight_fg_color=
6262
]
6363

6464
class Core
@@ -273,9 +273,9 @@ def get_screen_size
273273
scrollbar: true,
274274
height: 15,
275275
bg_color: config.dialog_default_bg_color_sequence,
276-
pointer_bg_color: config.dialog_pointer_bg_color_sequence,
276+
pointer_bg_color: config.dialog_highlight_bg_color_sequence,
277277
fg_color: config.dialog_default_fg_color_sequence,
278-
pointer_fg_color: config.dialog_pointer_fg_color_sequence
278+
pointer_fg_color: config.dialog_highlight_fg_color_sequence
279279
)
280280
}
281281
Reline::DEFAULT_DIALOG_CONTEXT = Array.new
@@ -586,8 +586,8 @@ def self.core
586586
core.add_dialog_proc(:autocomplete, Reline::DEFAULT_DIALOG_PROC_AUTOCOMPLETE, Reline::DEFAULT_DIALOG_CONTEXT)
587587
core.dialog_default_bg_color = :cyan
588588
core.dialog_default_fg_color = :white
589-
core.dialog_pointer_bg_color = :magenta
590-
core.dialog_pointer_fg_color = :white
589+
core.dialog_highlight_bg_color = :magenta
590+
core.dialog_highlight_fg_color = :white
591591
}
592592
end
593593

lib/reline/config.rb

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ class InvalidInputrc < RuntimeError
4848
attr_accessor :autocompletion
4949
attr_reader :dialog_default_bg_color_sequence,
5050
:dialog_default_fg_color_sequence,
51-
:dialog_pointer_bg_color_sequence,
52-
:dialog_pointer_fg_color_sequence
51+
:dialog_highlight_bg_color_sequence,
52+
:dialog_highlight_fg_color_sequence
5353

5454
def initialize
5555
@additional_key_bindings = {} # from inputrc
@@ -76,9 +76,9 @@ def initialize
7676
@autocompletion = false
7777
@convert_meta = true if seven_bit_encoding?(Reline::IOGate.encoding)
7878
@dialog_default_bg_color_sequence = nil
79-
@dialog_pointer_bg_color_sequence = nil
79+
@dialog_highlight_bg_color_sequence = nil
8080
@dialog_default_fg_color_sequence = nil
81-
@dialog_pointer_fg_color_sequence = nil
81+
@dialog_highlight_fg_color_sequence = nil
8282
end
8383

8484
def reset
@@ -112,12 +112,12 @@ def dialog_default_fg_color=(color)
112112
@dialog_default_fg_color_sequence = dialog_color_to_code(:fg, color)
113113
end
114114

115-
def dialog_pointer_bg_color=(color)
116-
@dialog_pointer_bg_color_sequence = dialog_color_to_code(:bg, color)
115+
def dialog_highlight_bg_color=(color)
116+
@dialog_highlight_bg_color_sequence = dialog_color_to_code(:bg, color)
117117
end
118118

119-
def dialog_pointer_fg_color=(color)
120-
@dialog_pointer_fg_color_sequence = dialog_color_to_code(:fg, color)
119+
def dialog_highlight_fg_color=(color)
120+
@dialog_highlight_fg_color_sequence = dialog_color_to_code(:fg, color)
121121
end
122122

123123
def dialog_default_bg_color
@@ -128,12 +128,12 @@ def dialog_default_fg_color
128128
dialog_code_to_color(:fg, @dialog_default_fg_color_sequence)
129129
end
130130

131-
def dialog_pointer_bg_color
132-
dialog_code_to_color(:bg, @dialog_pointer_bg_color_sequence)
131+
def dialog_highlight_bg_color
132+
dialog_code_to_color(:bg, @dialog_highlight_bg_color_sequence)
133133
end
134134

135-
def dialog_pointer_fg_color
136-
dialog_code_to_color(:fg, @dialog_pointer_fg_color_sequence)
135+
def dialog_highlight_fg_color
136+
dialog_code_to_color(:fg, @dialog_highlight_fg_color_sequence)
137137
end
138138

139139
COLORS = [
@@ -399,10 +399,10 @@ def bind_variable(name, value)
399399
self.dialog_default_bg_color = value
400400
when 'dialog-default-fg-color'
401401
self.dialog_default_fg_color = value
402-
when 'dialog-pointer-bg-color'
403-
self.dialog_pointer_bg_color = value
404-
when 'dialog-pointer-fg-color'
405-
self.dialog_pointer_fg_color = value
402+
when 'dialog-highlight-bg-color'
403+
self.dialog_highlight_bg_color = value
404+
when 'dialog-highlight-fg-color'
405+
self.dialog_highlight_fg_color = value
406406
when *VARIABLE_NAMES then
407407
variable_name = :"@#{name.tr(?-, ?_)}"
408408
instance_variable_set(variable_name, value.nil? || value == '1' || value == 'on')

test/reline/test_config.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -412,15 +412,15 @@ def test_relative_xdg_config_home
412412
def test_dialog_configurations
413413
@config.read_lines(<<~LINES.lines)
414414
set dialog-default-bg-color white
415-
set dialog-pointer-bg-color black
415+
set dialog-highlight-bg-color black
416416
set dialog-default-fg-color cyan
417-
set dialog-pointer-fg-color magenta
417+
set dialog-highlight-fg-color magenta
418418
LINES
419419

420420
assert_equal :white, @config.dialog_default_bg_color
421-
assert_equal :black, @config.dialog_pointer_bg_color
421+
assert_equal :black, @config.dialog_highlight_bg_color
422422
assert_equal :cyan, @config.dialog_default_fg_color
423-
assert_equal :magenta, @config.dialog_pointer_fg_color
423+
assert_equal :magenta, @config.dialog_highlight_fg_color
424424
end
425425
end
426426

test/reline/test_reline.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ def test_dialog_color_configuration
5050
# defaults
5151
assert_equal(:cyan, Reline.dialog_default_bg_color)
5252
assert_equal(:white, Reline.dialog_default_fg_color)
53-
assert_equal(:magenta, Reline.dialog_pointer_bg_color)
54-
assert_equal(:white, Reline.dialog_pointer_fg_color)
53+
assert_equal(:magenta, Reline.dialog_highlight_bg_color)
54+
assert_equal(:white, Reline.dialog_highlight_fg_color)
5555

5656
Reline.dialog_default_bg_color = :black
5757
assert_equal(:black, Reline.dialog_default_bg_color)
@@ -61,17 +61,17 @@ def test_dialog_color_configuration
6161
assert_equal(:white, Reline.dialog_default_fg_color)
6262
assert_equal(37, Reline.dialog_default_fg_color_sequence)
6363

64-
Reline.dialog_pointer_bg_color = :white
65-
assert_equal(:white, Reline.dialog_pointer_bg_color)
66-
assert_equal(47, Reline.dialog_pointer_bg_color_sequence)
64+
Reline.dialog_highlight_bg_color = :white
65+
assert_equal(:white, Reline.dialog_highlight_bg_color)
66+
assert_equal(47, Reline.dialog_highlight_bg_color_sequence)
6767

68-
Reline.dialog_pointer_fg_color = :black
69-
assert_equal(:black, Reline.dialog_pointer_fg_color)
70-
assert_equal(30, Reline.dialog_pointer_fg_color_sequence)
68+
Reline.dialog_highlight_fg_color = :black
69+
assert_equal(:black, Reline.dialog_highlight_fg_color)
70+
assert_equal(30, Reline.dialog_highlight_fg_color_sequence)
7171

7272
# test value validation
7373
assert_raise(ArgumentError) do
74-
Reline.dialog_pointer_fg_color = :foo
74+
Reline.dialog_highlight_fg_color = :foo
7575
end
7676
end
7777

0 commit comments

Comments
 (0)