summaryrefslogtreecommitdiff
path: root/lib/reline
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2021-09-06 05:12:15 +0900
committergit <svn-admin@ruby-lang.org>2021-09-06 05:35:03 +0900
commit32ff4a8c93f1e186cef94197827bb9c137f4c31d (patch)
tree1bdbc91283141542bc0836a32fc9fe591526b1a3 /lib/reline
parent991eb4894d4e2e130774ad51f5b0ab42b869a4b5 (diff)
[ruby/reline] Set scrollbar color
https://github.com/ruby/reline/commit/d7962e420d
Diffstat (limited to 'lib/reline')
-rw-r--r--lib/reline/line_editor.rb14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index 360106621f..8a23cc0dac 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -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