Class: Textbringer::OverwriteMode

Inherits:
MinorMode
  • Object
show all
Defined in:
lib/textbringer/modes/overwrite_mode.rb

Constant Summary collapse

POST_INSERT_HOOK =
-> {
  buffer = Buffer.current
  s = Controller.current.last_key * number_prefix_arg
  begin
    buffer.delete_char(s.size)
  rescue RangeError
    buffer.save_excursion do
      pos = buffer.point
      buffer.end_of_buffer
      buffer.delete_region(pos, buffer.point)
    end
  end
}

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::EXPRESSION_COMPLETOR, Utils::EXPRESSION_COMPLETOR_OPTIONS, Utils::HOOKS

Instance Attribute Summary

Attributes inherited from MinorMode

#buffer

Instance Method Summary collapse

Methods inherited from MinorMode

inherited, #initialize, #name

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!, get_hooks, 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, run_hooks_in, self_insert_and_exit_minibuffer, set_transient_map, show_exception, sit_for, sleep_for, y_or_n?, yes_or_no?

Constructor Details

This class inherits a constructor from Textbringer::MinorMode

Instance Method Details

#disableObject



23
24
25
# File 'lib/textbringer/modes/overwrite_mode.rb', line 23

def disable
  remove_hook(:post_self_insert_hook, POST_INSERT_HOOK, local: true)
end

#enableObject



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

def enable
  add_hook(:post_self_insert_hook, POST_INSERT_HOOK, local: true)
end