diff options
author | pocari <[email protected]> | 2022-06-27 22:28:34 +0900 |
---|---|---|
committer | git <[email protected]> | 2022-06-27 22:28:49 +0900 |
commit | 8c6c3e30f3a86ba0b697a0d99efe8ff4585c4a42 (patch) | |
tree | 2073fde89b3c57858cb5909b2e036bebd18ca5ea /lib/reline/line_editor.rb | |
parent | b6b9a6190def53aa53ac816a51034fa1c96ed70b (diff) |
[ruby/reline] Enable to change the background color of dialogs. (https://github.com/ruby/reline/pull/413)
https://github.com/ruby/reline/commit/bd49537964
Diffstat (limited to 'lib/reline/line_editor.rb')
-rw-r--r-- | lib/reline/line_editor.rb | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index 135432a5d1..8d0719ef7c 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -743,17 +743,15 @@ class Reline::LineEditor Reline::IOGate.move_cursor_column(dialog.column) dialog.contents.each_with_index do |item, i| if i == pointer - bg_color = '45' + fg_color = dialog_render_info.pointer_fg_color + bg_color = dialog_render_info.pointer_bg_color else - if dialog_render_info.bg_color - bg_color = dialog_render_info.bg_color - else - bg_color = '46' - end + fg_color = dialog_render_info.fg_color + bg_color = dialog_render_info.bg_color end str_width = dialog.width - (dialog.scrollbar_pos.nil? ? 0 : @block_elem_width) str = padding_space_with_escape_sequences(Reline::Unicode.take_range(item, 0, str_width), str_width) - @output.write "\e[#{bg_color}m#{str}" + @output.write "\e[#{bg_color}m\e[#{fg_color}m#{str}" if dialog.scrollbar_pos and (dialog.scrollbar_pos != old_dialog.scrollbar_pos or dialog.column != old_dialog.column) @output.write "\e[37m" if dialog.scrollbar_pos <= (i * 2) and (i * 2 + 1) < (dialog.scrollbar_pos + bar_height) |