Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/tty/prompt/multi_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,7 @@ def render_menu
indicator = (index + 1 == @active) ? @symbols[:marker] : " "
indicator += " "
message = if @selected.include?(choice) && !choice.disabled?
selected = @prompt.decorate(@symbols[:radio_on], @active_color)
"#{selected} #{num}#{choice.name}"
@prompt.decorate("#{@symbols[:radio_on]} #{num}#{choice.name}", @active_color)
elsif choice.disabled?
@prompt.decorate(@symbols[:cross], :red) +
" #{num}#{choice.name} #{choice.disabled}"
Expand Down
12 changes: 6 additions & 6 deletions spec/unit/multi_select_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def output_helper(prompt, choices, active, selected, options = {})
prefix += if disabled
"\e[31m#{symbols[:cross]}\e[0m #{num}#{name} #{disabled}"
elsif selected.include?(name)
"\e[32m#{symbols[:radio_on]}\e[0m #{num}#{name}"
"\e[32m#{symbols[:radio_on]} #{num}#{name}\e[0m"
else
"#{symbols[:radio_off]} #{num}#{name}"
end
Expand Down Expand Up @@ -99,7 +99,7 @@ def exit_message(prompt, choices)
" #{symbols[:radio_off]} bourbon",
"\e[2K\e[1G\e[1A" * 5, "\e[2K\e[1G",
"Select drinks? \n",
"#{symbols[:marker]} \e[32m#{symbols[:radio_on]}\e[0m vodka\n",
"#{symbols[:marker]} \e[32m#{symbols[:radio_on]} vodka\e[0m\n",
" #{symbols[:radio_off]} beer\n",
" #{symbols[:radio_off]} wine\n",
" #{symbols[:radio_off]} whisky\n",
Expand Down Expand Up @@ -149,7 +149,7 @@ def exit_message(prompt, choices)
" - 5) bourbon",
"\e[2K\e[1G\e[1A" * 5, "\e[2K\e[1G",
"Select drinks? vodka\n",
"> \e[32m=\e[0m 1) vodka\n",
"> \e[32m= 1) vodka\e[0m\n",
" - 2) beer\n",
" - 3) wine\n",
" - 4) whisky\n",
Expand All @@ -175,10 +175,10 @@ def exit_message(prompt, choices)
expect(prompt.output.string).to eq([
"\e[?25lSelect drinks? beer, bourbon \e[90m(Press #{up_down} arrow to move, Space/Ctrl+A|R to select (all|rev) and Enter to finish)\e[0m\n",
" #{symbols[:radio_off]} vodka\n",
" \e[32m#{symbols[:radio_on]}\e[0m beer\n",
" \e[32m#{symbols[:radio_on]} beer\e[0m\n",
" #{symbols[:radio_off]} wine\n",
" #{symbols[:radio_off]} whisky\n",
"#{symbols[:marker]} \e[32m#{symbols[:radio_on]}\e[0m bourbon",
"#{symbols[:marker]} \e[32m#{symbols[:radio_on]} bourbon\e[0m",
"\e[2K\e[1G\e[1A" * 5, "\e[2K\e[1G",
"Select drinks? \e[32mbeer, bourbon\e[0m\n\e[?25h"
].join)
Expand Down Expand Up @@ -277,7 +277,7 @@ def exit_message(prompt, choices)
expect(prompt.multi_select("Select drinks?", choices, options)).to eq(["vodka"])
expect(prompt.output.string).to eq([
"\e[?25lSelect drinks? vodka \e[90m(Press #{up_down} arrow to move, Space/Ctrl+A|R to select (all|rev) and Enter to finish)\e[0m\n",
"> \e[34m#{symbols[:radio_on]}\e[0m vodka\n",
"> \e[34m#{symbols[:radio_on]} vodka\e[0m\n",
" #{symbols[:radio_off]} beer\n",
" #{symbols[:radio_off]} wine\n",
" #{symbols[:radio_off]} whisky\n",
Expand Down