Skip to content

Commit

Permalink
Merge pull request #333 from aycabta/set-scrollbar-color
Browse files Browse the repository at this point in the history
Set scrollbar color
  • Loading branch information
aycabta committed Sep 5, 2021
2 parents acbccaf + d7962e4 commit c30632f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/reline/line_editor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -692,18 +692,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
Expand Down

0 comments on commit c30632f

Please sign in to comment.