Class: Textbringer::HelpMode

Inherits:
Mode
  • Object
show all
Defined in:
lib/textbringer/modes/help_mode.rb

Constant Summary

Constants inherited from Mode

Mode::DEFAULT_SYNTAX_TABLE

Constants included from Commands

Commands::CLIPBOARD_AVAILABLE, Commands::CTAGS, Commands::HELP_RING, Commands::ISEARCH_STATUS, Commands::KEYBOARD_MACROS, Commands::REGISTERS, Commands::RE_SEARCH_STATUS

Constants included from Utils

Utils::COMPLETION, Utils::HOOKS

Instance Attribute Summary

Attributes inherited from Mode

#buffer

Instance Method Summary collapse

Methods inherited from Mode

define_generic_command, define_local_command, define_syntax, inherited, list, #name, #syntax_table

Methods included from Commands

[], #command_help, command_table, #current_prefix_arg, define_command, #execute_keyboard_macro, #get_tags, #isearch_done, #isearch_mode, #isearch_mode?, #isearch_pre_command_hook, #isearch_prompt, #isearch_repeat, #isearch_repeat_backward, #isearch_repeat_forward, #isearch_search, #keymap_bindings, list, #match_beginning, #match_end, #match_string, #number_prefix_arg, #prefix_numeric_value, #read_input_method_name, #read_keyboard_macro, #read_register, #replace_match, undefine_command, #universal_argument_mode

Methods included from Utils

add_hook, background, complete_for_minibuffer, foreground, foreground!, message, read_buffer, read_char, read_command_name, read_encoding, read_event, read_expression, read_file_name, read_from_minibuffer, read_key_sequence, read_object, read_single_char, received_keyboard_quit?, remove_hook, ruby_install_name, run_hooks, self_insert_and_exit_minibuffer, set_transient_map, show_exception, sit_for, sleep_for, y_or_n?, yes_or_no?

Constructor Details

#initialize(buffer) ⇒ HelpMode

Returns a new instance of HelpMode.



18
19
20
21
# File 'lib/textbringer/modes/help_mode.rb', line 18

def initialize(buffer)
  super(buffer)
  buffer.keymap = HELP_MODE_MAP
end

Instance Method Details



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/textbringer/modes/help_mode.rb', line 23

def jump_to_link
  @buffer.save_excursion do
    @buffer.skip_re_backward(/[_a-zA-Z0-9]/)
    if @buffer.char_before == ?[ &&
        @buffer.looking_at?(/([_a-zA-Z][_a-zA-Z0-9]*)\]/)
      describe_command(match_string(1))
    else
      @buffer.beginning_of_line
      if @buffer.looking_at?(/^(\S*?):(\d+)$/)
        file_name = @buffer.match_string(1)
        line_number = @buffer.match_string(2).to_i
        find_file(file_name)
        goto_line(line_number)
      end
    end
  end
end