Skip to content

Commit d7962e4

Browse files
committed
Set scrollbar color
1 parent 9a77fc9 commit d7962e4

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/reline/line_editor.rb

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -679,18 +679,22 @@ def add_dialog_proc(name, p, context = nil)
679679
end
680680
end
681681
str = padding_space_with_escape_sequences(Reline::Unicode.take_range(item, 0, dialog.width), dialog.width)
682+
@output.write "\e[#{bg_color}m#{str}"
682683
if dialog_render_info.scrollbar and dialog_render_info.contents.size > height
684+
@output.write "\e[37m"
683685
if position <= (i * 2) and (i * 2 + 1) < (position + bar_height)
684-
str += '█'
686+
@output.write '█'
685687
elsif position <= (i * 2) and (i * 2) < (position + bar_height)
686-
str += '▀'
688+
@output.write '▀'
689+
str += ''
687690
elsif position <= (i * 2 + 1) and (i * 2) < (position + bar_height)
688-
str += '▄'
691+
@output.write '▄'
689692
else
690-
str += ' '
693+
@output.write ' '
691694
end
695+
@output.write "\e[39m"
692696
end
693-
@output.write "\e[#{bg_color}m#{str}\e[49m"
697+
@output.write "\e[49m"
694698
Reline::IOGate.move_cursor_column(dialog.column)
695699
move_cursor_down(1) if i < (dialog.contents.size - 1)
696700
end

0 commit comments

Comments
 (0)