Class: Redwood::LabelListMode

Inherits:
LineCursorMode show all
Defined in:
lib/sup/modes/label-list-mode.rb

Constant Summary

Constant Summary

Constants inherited from ScrollMode

ScrollMode::COL_JUMP

Instance Attribute Summary

Attributes inherited from LineCursorMode

#curpos

Attributes inherited from ScrollMode

#botline, #leftcol, #status, #topline

Attributes inherited from Mode

#buffer

Instance Method Summary (collapse)

Methods inherited from LineCursorMode

#draw

Methods inherited from ScrollMode

#at_bottom?, #at_top?, #cancel_search!, #col_left, #col_right, #continue_search_in_buffer, #draw, #ensure_mode_validity, #half_page_down, #half_page_up, #in_search?, #jump_to_col, #jump_to_end, #jump_to_left, #jump_to_line, #jump_to_start, #line_down, #line_up, #page_down, #page_up, #resize, #rightcol, #search_goto_line, #search_goto_pos, #search_in_buffer, #search_start_line

Methods inherited from Mode

#blur, #cancel_search!, #cleanup, #draw, #handle_input, #help_text, #in_search?, #killable?, load_all_modes, make_name, #name, #pipe_to_process, register_keymap, #resize, #resolve_input, #save_to_file, #status

Constructor Details

- (LabelListMode) initialize

Returns a new instance of LabelListMode



11
12
13
14
15
16
17
# File 'lib/sup/modes/label-list-mode.rb', line 11

def initialize
  @labels = []
  @text = []
  @unread_only = false
  super
  regen_text
end

Instance Method Details

- (Object) [](i)



20
# File 'lib/sup/modes/label-list-mode.rb', line 20

def [] i; @text[i] end

- (Object) focus



33
34
35
# File 'lib/sup/modes/label-list-mode.rb', line 33

def focus
  reload # make sure unread message counts are up-to-date
end

- (Object) jump_to_next_new



22
23
24
25
26
27
28
29
30
31
# File 'lib/sup/modes/label-list-mode.rb', line 22

def jump_to_next_new
  n = ((curpos + 1) ... lines).find { |i| @labels[i][1] > 0 } || (0 ... curpos).find { |i| @labels[i][1] > 0 }
  if n
    ## jump there if necessary
    jump_to_line n unless n >= topline && n < botline
    set_cursor_pos n
  else
    BufferManager.flash "No labels messages with unread messages."
  end
end

- (Object) lines



19
# File 'lib/sup/modes/label-list-mode.rb', line 19

def lines; @text.length end