summaryrefslogtreecommitdiff
path: root/lib/reline.rb
diff options
context:
space:
mode:
authorHASUMI Hitoshi <[email protected]>2023-11-06 23:40:38 +0900
committergit <[email protected]>2023-11-06 14:40:42 +0000
commit16403f41abcbaccf32484d10575d3542dbb3247e ()
treeafca50d51bcb5bcb432dc35581fa7f251ea02dc0 /lib/reline.rb
parentf6ba87ca8899cd753306ffbca475b16c367995a3 (diff)
[ruby/reline] Introduce a new class Reline::Face to configure
character attributes (https://.com/ruby/reline/pull/552) * Reine::Face * fix test_yamatanooroti * Define singleton methods to make accessors to attributes of a face * s/display/foreground/ * s/default/default_style/ && s/normal_line/default/ && s/enhanced_line/enhanced/ * fix typo * FaceConfig.new now takes keyword arguments * Update lib/reline/face.rb Co-authored-by: Stan Lo <[email protected]> * Update test/reline/test_face.rb Co-authored-by: Stan Lo <[email protected]> * Fix to correspond to frozen_string_literal * Face::FaceConfig -> Face::Config * ref https://.com/ruby/reline/pull/552#pullrequestreview-1677282576 * delete unused ivar * ref https://.com/ruby/reline/pull/552#discussion_r1358783723 * insert "\e[0m" into all SGR * tiny fix * ESSENTIAL_DEFINE_NAMES ref https://.com/ruby/reline/pull/552#discussion_r1367722247 * Change to Hash-accessor style - Reline::Face[:completion_dialog].enhanced -> Reline::Face[:completion_dialog][:enhanced] - Reline::Face.configs shows all defined values * Cache array method call in local variable * Tests for Face configuration variations * resolve https://.com/ruby/reline/pull/552#pullrequestreview-1710938154 * amend to * check invalid SGR parameter in :style * The order of define values should be preserved * Update test/reline/test_face.rb Co-authored-by: Stan Lo <[email protected]> * Update test/reline/test_face.rb Co-authored-by: Stan Lo <[email protected]> * Add methods: load_initial_config and reset_to_initial_config. And teardown in tests * omission in amending "style: :default" to "style: :reset" * refs https://.com/ruby/reline/issues/598 * Fix link * amend method name * Update lib/reline/face.rb Co-authored-by: ima1zumi <[email protected]> --------- https://.com/ruby/reline/commit/fdc1d3b1e5 Co-authored-by: Stan Lo <[email protected]> Co-authored-by: ima1zumi <[email protected]>
-rw-r--r--lib/reline.rb14
1 files changed, 6 insertions, 8 deletions
@@ -7,6 +7,7 @@ require 'reline/key_stroke'
require 'reline/line_editor'
require 'reline/history'
require 'reline/terminfo'
require 'rbconfig'
module Reline
@@ -36,10 +37,8 @@ module Reline
DialogRenderInfo = Struct.new(
:pos,
:contents,
- :bg_color,
- :pointer_bg_color,
- :fg_color,
- :pointer_fg_color,
:width,
:height,
:scrollbar,
@@ -260,10 +259,7 @@ module Reline
contents: result,
scrollbar: true,
height: [15, preferred_dialog_height].min,
- bg_color: 46,
- pointer_bg_color: 45,
- fg_color: 37,
- pointer_fg_color: 37
)
}
Reline::DEFAULT_DIALOG_CONTEXT = Array.new
@@ -606,4 +602,6 @@ else
io
end
Reline::HISTORY = Reline::History.new(Reline.core.config)