From d7962e420d03b2a9a80110a3d00f26d46d90f13c Mon Sep 17 00:00:00 2001 From: aycabta Date: Mon, 6 Sep 2021 05:12:15 +0900 Subject: [PATCH] Set scrollbar color --- lib/reline/line_editor.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index 21db97fce6..5099e642f4 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -679,18 +679,22 @@ def add_dialog_proc(name, p, context = nil) end end str = padding_space_with_escape_sequences(Reline::Unicode.take_range(item, 0, dialog.width), dialog.width) + @output.write "\e[#{bg_color}m#{str}" if dialog_render_info.scrollbar and dialog_render_info.contents.size > height + @output.write "\e[37m" if position <= (i * 2) and (i * 2 + 1) < (position + bar_height) - str += '█' + @output.write '█' elsif position <= (i * 2) and (i * 2) < (position + bar_height) - str += '▀' + @output.write '▀' + str += '' elsif position <= (i * 2 + 1) and (i * 2) < (position + bar_height) - str += '▄' + @output.write '▄' else - str += ' ' + @output.write ' ' end + @output.write "\e[39m" end - @output.write "\e[#{bg_color}m#{str}\e[49m" + @output.write "\e[49m" Reline::IOGate.move_cursor_column(dialog.column) move_cursor_down(1) if i < (dialog.contents.size - 1) end