Class: RubyCurses::DefaultRubyRenderer
- Defined in:
- lib/rbcurse/core/widgets/textpad.rb
Overview
a test renderer to see how things go
Instance Method Summary collapse
Instance Method Details
#render(pad, lineno, text) ⇒ Object
480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 |
# File 'lib/rbcurse/core/widgets/textpad.rb', line 480 def render pad, lineno, text bg = :black fg = :white att = NORMAL cp = $datacolor if text =~ /^\s*# / fg = :red cp = get_color($datacolor, fg, bg) elsif text =~ /^\s*#/ fg = :blue cp = get_color($datacolor, fg, bg) elsif text =~ /^\s*class / fg = :magenta cp = get_color($datacolor, fg, bg) elsif text =~ /^\s*def / fg = :yellow att = BOLD cp = get_color($datacolor, fg, bg) elsif text =~ /^\s*(begin|rescue|ensure|end)/ fg = :magenta att = BOLD cp = get_color($datacolor, fg, bg) end FFI::NCurses.wattron(pad,FFI::NCurses.COLOR_PAIR(cp) | att) FFI::NCurses.mvwaddstr(pad, lineno, 0, text) FFI::NCurses.wattroff(pad,FFI::NCurses.COLOR_PAIR(cp) | att) end |