Different color for selection-marker
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Junegunn Choi · committed by Junegunn Choi · parent f0b2b98 · Browse files · 1 file·+26 added−26 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+26 added−26 removed
- other:+26 added−26 removed
Provenance
- Commit
f0a5757- Tree
a11d1bd- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
f0b2b98
1 file changed+26 added−26 removed
modified:fzf+26 added-26 removed
90 unmodified lines91 @query = AtomicVar.new('')92 @matches = AtomicVar.new([])93 @count = AtomicVar.new(0)94 @vcursor = AtomicVar.new(0)95- @fan = AtomicVar.new('-\|/-\|/'.split(//))95+ @spinner = AtomicVar.new('-\|/-\|/'.split(//))96 @selects = AtomicVar.new({}) # ordered >= 1.997 end98 99 def start145 unmodified lines245 246 def print_input247 C.setpos cursor_y, 0248 C.clrtoeol249- cprint '> ', color(:blue, true)249+ cprint '> ', color(:prompt, true)250 C.attron(C::A_BOLD) do251 C.addstr @query.get252 end253 end1 unmodified line255 def print_info msg = nil256 C.setpos cursor_y - 1, 0257 C.clrtoeol258 prefix =259- if fan = @fan.shift260- @fan.push fan261- cprint fan, color(:fan, true)259+ if spinner = @spinner.shift260+ @spinner.push spinner261+ cprint spinner, color(:spinner, true)262 ' '263 else264 ' '265 end58 unmodified lines324 def print_item row, tokens, chosen, selected325 # Cursor326 C.setpos row, 0327 C.clrtoeol328- cprint chosen ? '>' : ' ', color(:red, true)328+ cprint chosen ? '>' : ' ', color(:cursor, true)329 cprint selected ? '>' : ' ',330- chosen ? color(:chosen) : (selected ? color(:red, true) : 0)330+ chosen ? color(:chosen) : (selected ? color(:selected, true) : 0)331 332 # Highlighted item333 C.attron color(:chosen, true) if chosen334 tokens.each do |pair|81 unmodified lines416 C.noecho417 418 if @color419 if C.can_change_color?420- fg = ENV.fetch('FZF_FG', 252).to_i421- bg = ENV.fetch('FZF_BG', 236).to_i422- C.init_pair 1, 110, dbg423- C.init_pair 2, 108, dbg424- C.init_pair 3, fg + 2, bg425- C.init_pair 4, 151, bg426- C.init_pair 5, 148, dbg427- C.init_pair 6, 144, dbg428- C.init_pair 7, 161, bg420+ C.init_pair 1, 110, dbg421+ C.init_pair 2, 108, dbg422+ C.init_pair 3, 254, 236423+ C.init_pair 4, 151, 236424+ C.init_pair 5, 148, dbg425+ C.init_pair 6, 144, dbg426+ C.init_pair 7, 161, 236427+ C.init_pair 8, 168, 236428 else430- C.init_pair 1, C::COLOR_BLUE, dbg431- C.init_pair 2, C::COLOR_GREEN, dbg432- C.init_pair 3, C::COLOR_YELLOW, C::COLOR_BLACK433- C.init_pair 4, C::COLOR_GREEN, C::COLOR_BLACK434- C.init_pair 5, C::COLOR_GREEN, dbg435- C.init_pair 6, C::COLOR_WHITE, dbg436- C.init_pair 7, C::COLOR_RED, C::COLOR_BLACK429+ C.init_pair 1, C::COLOR_BLUE, dbg430+ C.init_pair 2, C::COLOR_GREEN, dbg431+ C.init_pair 3, C::COLOR_YELLOW, C::COLOR_BLACK432+ C.init_pair 4, C::COLOR_GREEN, C::COLOR_BLACK433+ C.init_pair 5, C::COLOR_GREEN, dbg434+ C.init_pair 6, C::COLOR_WHITE, dbg435+ C.init_pair 7, C::COLOR_RED, C::COLOR_BLACK436+ C.init_pair 8, C::COLOR_MAGENTA, C::COLOR_BLACK437 end438 439 def self.color sym, bold = false440- C.color_pair([:blue, :match, :chosen,441- :match!, :fan, :info, :red].index(sym) + 1) |440+ C.color_pair([:prompt, :match, :chosen, :match!,441+ :spinner, :info, :cursor, :selected].index(sym) + 1) |442 (bold ? C::A_BOLD : 0)443 end444 else445 def self.color sym, bold = false29 unmodified lines475 while line = stream.gets476 emit(:new) { @new << line.chomp }477 end478 emit(:loaded) { true }479- @fan.clear479+ @spinner.clear480 end481 end482 483 def start_search324 unmodified lines