1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/reline] Set scrollbar color

https://github.com/ruby/reline/commit/d7962e420d
This commit is contained in:
aycabta 2021-09-06 05:12:15 +09:00 committed by git
parent 991eb4894d
commit 32ff4a8c93

View file

@ -692,18 +692,22 @@ class Reline::LineEditor
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