Class: Rfd::PreviewWindow

Inherits:
SubWindow show all
Includes:
RougeSupport
Defined in:
lib/rfd/preview_window.rb

Defined Under Namespace

Modules: RougeSupport

Constant Summary

Constants included from RougeSupport

RougeSupport::ROUGE_COLORS

Instance Attribute Summary

Attributes inherited from SubWindow

#controller, #window

Instance Method Summary collapse

Methods included from RougeSupport

#rouge_token_color

Methods inherited from SubWindow

#close, #create_window, #draw_border, #height, #initialize, #left, #max_height, #max_width, #refresh, #reposition_if_needed, #top, #width

Constructor Details

This class inherits a constructor from Rfd::SubWindow

Instance Method Details

#handle_input(c) ⇒ Object



62
63
64
65
# File 'lib/rfd/preview_window.rb', line 62

def handle_input(c)
  # Preview window doesn't handle input - pass through to main
  false
end

#renderObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/rfd/preview_window.rb', line 27

def render
  reposition_if_needed
  @window.clear

  item = controller.current_item

  # Hide preview for current directory (.)
  if item.name == '.'
    @window.refresh
    return
  end

  draw_border(item.name)

  if item.video?
    render_video(item)
  elsif item.heic?
    render_heic(item)
  elsif item.directory?
    render_directory(item)
  elsif item.archive?
    render_archive(item)
  elsif item.image?
    render_image(item)
  elsif item.pdf?
    render_pdf(item)
  elsif item.markdown?
    render_markdown(item)
  else
    render_text(item)
  end

  @window.refresh
end