Class: Redwood::LabelListMode

Inherits:
LineCursorMode show all
Defined in:
lib/sup/modes/label_list_mode.rb

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_jump, #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!, #draw, #handle_input, #help_text, #in_search?, keymap, keymaps, #killable?, load_all_modes, make_name, #name, #pipe_to_process, register_keymap, #resize, #resolve_input, #save_to_file, #status, #unsaved?

Constructor Details

#initializeLabelListMode

Returns a new instance of LabelListMode.



29
30
31
32
33
34
35
36
# File 'lib/sup/modes/label_list_mode.rb', line 29

def initialize
  @labels = []
  @text = []
  @unread_only = false
  super
  UpdateManager.register self
  regen_text
end

Instance Method Details

#[](i) ⇒ Object



44
# File 'lib/sup/modes/label_list_mode.rb', line 44

def [] i; @text[i] end

#cleanupObject



38
39
40
41
# File 'lib/sup/modes/label_list_mode.rb', line 38

def cleanup
  UpdateManager.unregister self
  super
end

#focusObject



57
58
59
# File 'lib/sup/modes/label_list_mode.rb', line 57

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

#handle_added_update(sender, m) ⇒ Object



61
62
63
# File 'lib/sup/modes/label_list_mode.rb', line 61

def handle_added_update sender, m
  reload
end

#jump_to_next_newObject



46
47
48
49
50
51
52
53
54
55
# File 'lib/sup/modes/label_list_mode.rb', line 46

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

#linesObject



43
# File 'lib/sup/modes/label_list_mode.rb', line 43

def lines; @text.length end