Module RbReadline
In: lib/rbreadline/version.rb
lib/rbreadline.rb

Methods

__rl_fix_point   _extract_last_quote   _rl_abort_internal   _rl_adjust_point   _rl_any_typein   _rl_arg_dispatch   _rl_arg_getchar   _rl_arg_init   _rl_arg_overflow   _rl_backspace   _rl_bind_tty_special_chars   _rl_char_search   _rl_char_search_internal   _rl_char_value   _rl_clean_up_for_exit   _rl_clear_screen   _rl_clear_to_eol   _rl_col_width   _rl_compare_chars   _rl_control_keypad   _rl_copy_to_kill_ring   _rl_current_display_line   _rl_dispatch   _rl_dispatch_subseq   _rl_enable_meta_key   _rl_erase_at_end_of_line   _rl_erase_entire_line   _rl_find_completion_word   _rl_find_next_mbchar   _rl_find_prev_mbchar   _rl_fix_point   _rl_get_char_len   _rl_get_screen_size   _rl_history_set_point   _rl_init_eightbit   _rl_init_line_state   _rl_init_terminal_io   _rl_input_available   _rl_insert_char   _rl_insert_next   _rl_insert_typein   _rl_internal_char_cleanup   _rl_internal_pager   _rl_is_mbchar_matched   _rl_isearch_cleanup   _rl_isearch_dispatch   _rl_isearch_fini   _rl_isearch_init   _rl_make_prompt_for_search   _rl_move_cursor_relative   _rl_move_vert   _rl_nsearch_abort   _rl_nsearch_cleanup   _rl_nsearch_dispatch   _rl_nsearch_dosearch   _rl_nsearch_init   _rl_output_some_chars   _rl_overwrite_char   _rl_overwrite_rubout   _rl_read_init_file   _rl_read_mbchar   _rl_read_mbstring   _rl_redisplay_after_sigwinch   _rl_replace_text   _rl_reset_argument   _rl_rubout_char   _rl_scxt_alloc   _rl_search_getchar   _rl_set_insert_mode   _rl_set_mark_at_pos   _rl_start_using_history   _rl_strip_prompt   _rl_subseq_getchar   _rl_to_lower   _rl_unget_char   _rl_update_final   _rl_vi_done_inserting   _rl_vi_initialize_line   _rl_vi_reset_last   _rl_vi_save_insert   _rl_vi_textmod_command   _rl_walphabetic   add_history   alloc_history_entry   alloc_undo_entry   append_to_match   bind_arrow_keys   bind_arrow_keys_internal   bind_termcap_arrow_keys   block_sigint   clear_history   compute_lcd_of_matches   cr   cr_faster   ctrl_char   current_history   delete_chars   display_matches   endsrch_char   expand_prompt   fnprint   fnwidth   gen_completion_matches   get_term_capabilities   get_y_or_n   handle_parser_directive   hist_inittime   history_arg_extract   history_get   history_is_stifled   history_list   history_search_pos   history_search_prefix   history_set_pos   ibuffer_space   init_line_structures   insert_all_matches   insert_match   insert_some_chars   inv_line   inv_llen   isascii   isprint   m_offset   make_history_line_current   make_quoted_replacement   meta_char   next_history   noninc_dosearch   noninc_search   noninc_search_from_pos   parser_else   parser_endif   parser_if   parser_include   path_isdir   postprocess_matches   prepare_terminal_settings   previous_history   print_filename   printable_part   prompt_ending_index   readline   readline_default_bindings   readline_initialize_everything   readline_internal   readline_internal_charloop   readline_internal_setup   readline_internal_teardown   redraw_prompt   release_sigint   remove_duplicate_matches   remove_history   replace_history_data   replace_history_entry   retry_if_interrupted   rl_abort   rl_add_undo   rl_alphabetic   rl_arrow_keys   rl_backward   rl_backward_byte   rl_backward_char   rl_backward_char_search   rl_backward_kill_line   rl_backward_kill_word   rl_backward_word   rl_beg_of_line   rl_begin_undo_group   rl_beginning_of_history   rl_bind_key   rl_bind_keyseq_if_unbound   rl_bind_keyseq_if_unbound_in_map   rl_bind_keyseq_in_map   rl_capitalize_word   rl_change_case   rl_char_search   rl_character_len   rl_cleanup_after_signal   rl_clear_message   rl_clear_pending_input   rl_clear_screen   rl_clear_signals   rl_complete   rl_complete_internal   rl_completion_matches   rl_copy_text   rl_crlf   rl_delete   rl_delete_horizontal_space   rl_delete_or_show_completions   rl_delete_text   rl_deprep_terminal   rl_digit_argument   rl_digit_loop   rl_ding   rl_display_match_list   rl_display_search   rl_do_lowercase_version   rl_do_undo   rl_downcase_word   rl_emacs_editing_mode   rl_end_of_history   rl_end_of_line   rl_end_undo_group   rl_exchange_point_and_mark   rl_execute_next   rl_expand_prompt   rl_extend_line_buffer   rl_filename_completion_function   rl_forced_update_display   rl_forward   rl_forward_byte   rl_forward_char   rl_forward_search_history   rl_forward_word   rl_free_undo_list   rl_function_of_keyseq   rl_gather_tyi   rl_gather_tyi   rl_generic_bind   rl_get_char   rl_get_keymap_name_from_edit_mode   rl_get_next_history   rl_get_previous_history   rl_getc   rl_getc   rl_initialize   rl_insert   rl_insert_comment   rl_insert_completions   rl_insert_text   rl_isstate   rl_kill_full_line   rl_kill_line   rl_kill_text   rl_kill_word   rl_line_buffer   rl_maybe_replace_line   rl_maybe_save_line   rl_maybe_unsave_line   rl_message   rl_modifying   rl_named_function   rl_newline   rl_noninc_forward_search   rl_noninc_reverse_search   rl_on_new_line   rl_on_new_line_with_prompt   rl_overwrite_mode   rl_parse_and_bind   rl_possible_completions   rl_prep_terminal   rl_quoted_insert   rl_re_read_init_file   rl_read_init_file   rl_read_key   rl_redisplay   rl_refresh_line   rl_replace_from_history   rl_replace_line   rl_reset_line_state   rl_resize_terminal   rl_restart_output   rl_restore_prompt   rl_reverse_search_history   rl_revert_line   rl_rubout   rl_rubout_or_delete   rl_save_prompt   rl_search_history   rl_set_keymap_from_edit_mode   rl_set_mark   rl_set_prompt   rl_set_signals   rl_setstate   rl_sigwinch_handler   rl_stuff_char   rl_tab_insert   rl_tilde_expand   rl_transpose_chars   rl_transpose_words   rl_tty_set_default_bindings   rl_tty_unset_default_bindings   rl_undo_command   rl_unix_filename_rubout   rl_unix_line_discard   rl_unix_word_rubout   rl_unsetstate   rl_upcase_word   rl_username_completion_function   rl_variable_bind   rl_vi_check   rl_vi_editing_mode   rl_vi_insertion_mode   rl_yank   rl_yank_last_arg   rl_yank_nth_arg   rl_yank_nth_arg_internal   rl_yank_pop   save_tty_chars   set_completion_defaults   sh_set_lines_and_columns   space_to_eol   stat_char   stifle_history   tgetflag   trans   unstifle_history   update_line   using_history   vis_chars   vis_line   vis_llen   vis_pos   w_offset   where_history   whitespace  

Classes and Modules

Class RbReadline::Win32API

Constants

RB_READLINE_VERSION = "0.5.1"
RL_LIBRARY_VERSION = "5.2"
RL_READLINE_VERSION = 0x0502
EOF = "\xFF"
ESC = "\C-["
PAGE = "\C-L"
SPACE = "\x20"
RETURN = "\C-M"
ABORT_CHAR = "\C-G"
TAB = "\t"
RUBOUT = "\x7f"
NEWLINE = "\n"
DEFAULT_BUFFER_SIZE = 256
DEFAULT_MAX_KILLS = 10
MB_FIND_NONZERO = 1
MB_FIND_ANY = 0
MB_LEN_MAX = 4
DEFAULT_INPUTRC = "~/.inputrc"
SYS_INPUTRC = "/etc/inputrc"
UpCase = 1
DownCase = 2
CapCase = 3
EVENT_NOT_FOUND = 0   Possible history errors passed to hist_error.
BAD_WORD_SPEC = 1
SUBST_FAILED = 2
BAD_MODIFIER = 3
NO_PREV_SUBST = 4
ANCHORED_SEARCH = 1   Possible definitions for history starting point specification.
NON_ANCHORED_SEARCH = 0
HISTORY_APPEND = 0   Possible definitions for what style of writing the history file we want.
HISTORY_OVERWRITE = 1
READERR = 0xFE.chr   Input error; can be returned by (*rl_getc_function) if readline is reading
  a top-level command (RL_ISSTATE (RL_STATE_READCMD)).
RL_PROMPT_START_IGNORE = 1.chr   Definitions available for use by readline clients.
RL_PROMPT_END_IGNORE = 2.chr
NO_MATCH = 0   Possible values for do_replace argument to rl_filename_quoting_function,
  called by rl_complete_internal.
SINGLE_MATCH = 1
MULT_MATCH = 2
NUM_SAWMINUS = 0x01   Callback data for reading numeric arguments
NUM_SAWDIGITS = 0x02
NUM_READONE = 0x04
KSEQ_DISPATCHED = 0x01   A context for reading key sequences longer than a single character when
  using the callback interface.
KSEQ_SUBSEQ = 0x02
KSEQ_RECURSIVE = 0x04
RL_STATE_NONE = 0x000000   Possible state values for rl_readline_state
RL_STATE_INITIALIZING = 0x000001
RL_STATE_INITIALIZED = 0x000002
RL_STATE_TERMPREPPED = 0x000004
RL_STATE_READCMD = 0x000008
RL_STATE_METANEXT = 0x000010
RL_STATE_DISPATCHING = 0x000020
RL_STATE_MOREINPUT = 0x000040
RL_STATE_ISEARCH = 0x000080
RL_STATE_NSEARCH = 0x000100
RL_STATE_SEARCH = 0x000200
RL_STATE_NUMERICARG = 0x000400
RL_STATE_MACROINPUT = 0x000800
RL_STATE_MACRODEF = 0x001000
RL_STATE_OVERWRITE = 0x002000
RL_STATE_COMPLETING = 0x004000
RL_STATE_SIGHANDLER = 0x008000
RL_STATE_UNDOING = 0x010000
RL_STATE_INPUTPENDING = 0x020000
RL_STATE_TTYCSAVED = 0x040000
RL_STATE_CALLBACK = 0x080000
RL_STATE_VIMOTION = 0x100000
RL_STATE_MULTIKEY = 0x200000
RL_STATE_VICMDONCE = 0x400000
RL_STATE_DONE = 0x800000
NO_BELL = 0
AUDIBLE_BELL = 1
VISIBLE_BELL = 2
UNDO_END = 0,1,2,3
FTO = 1   Definitions used when searching the line for characters. NOTE: it is necessary that opposite directions are inverses
BTO = -1
FFIND = 2
BFIND = -2
RL_QF_SINGLE_QUOTE = 0x01   Possible values for the found_quote flags word used by the completion
  functions.  It says what kind of (shell-like) quoting we found anywhere
  in the line.
RL_QF_DOUBLE_QUOTE = 0x02
RL_QF_BACKSLASH = 0x04
RL_QF_OTHER_QUOTE = 0x08
KEYMAP_SIZE = 257
ANYOTHERKEY = KEYMAP_SIZE-1
RL_IM_INSERT = 1
RL_IM_OVERWRITE = 0
RL_IM_DEFAULT = RL_IM_INSERT
ISFUNC = 0
ISKMAP = 1
ISMACR = 2
HISTORY_WORD_DELIMITERS = " \t\n;&()|<>"
HISTORY_QUOTE_CHARACTERS = "\"'`"
RL_SEARCH_ISEARCH = 0x01
RL_SEARCH_NSEARCH = 0x02
RL_SEARCH_CSEARCH = 0x04
SF_REVERSE = 0x01   search flags
SF_FOUND = 0x02
SF_FAILED = 0x04
XOK = 1
STD_OUTPUT_HANDLE = -11
STD_INPUT_HANDLE = -10
KEY_EVENT = 1
VK_SHIFT = 0x10
VK_MENU = 0x12
VK_LMENU = 0xA4
VK_RMENU = 0xA5
LEFT_CTRL_PRESSED = 0x0008
RIGHT_CTRL_PRESSED = 0x0004
LEFT_ALT_PRESSED = 0x0002
RIGHT_ALT_PRESSED = 0x0001

Attributes

history_base  [RW] 
history_length  [RW] 
rl_attempted_completion_function  [RW] 
rl_attempted_completion_over  [RW] 
rl_basic_quote_characters  [RW] 
rl_basic_word_break_characters  [RW] 
rl_completer_quote_characters  [RW] 
rl_completer_word_break_characters  [RW] 
rl_completion_append_character  [RW] 
rl_deprep_term_function  [RW] 
rl_event_hook  [RW] 
rl_filename_quote_characters  [RW] 
rl_instream  [RW] 
rl_library_version  [RW] 
rl_outstream  [RW] 
rl_point  [RW] 
rl_readline_name  [RW] 

Public Instance methods

Fix up point so that it is within the line boundaries after killing

  text.  If FIX_MARK_TOO is non-zero, the mark is forced within line
  boundaries also.

How to abort things.

adjust pointed byte and find mbstate of the point of string.

  adjusted point will be point <= adjusted_point, and returns
  differences of the byte(adjusted_point - point).
  if point is invalied (point < 0 || more than string length),
  it returns -1

Process C as part of the current numeric argument. Return -1 if the

  argument should be aborted, 0 if we should not read any more chars, and
  1 if we should continue to read chars.

Move the cursor back.

Clear to the end of the line. COUNT is the minimum

  number of character spaces to clear,

compare the specified two characters. If the characters matched,

  return true. Otherwise return false.

Add TEXT to the kill ring, allocating a new kill ring slot as necessary.

  This uses TEXT directly, so the caller must not free it.  If APPEND is
  non-zero, and the last command was a kill, the text is appended to the
  current kill ring slot, otherwise prepended.

return the `current display line’ of the cursor — the number of lines to

  move up to get to the first screen line of the current readline line.

Do the command associated with KEY in MAP.

  If the associated command is really a keymap, then read
  another key, and dispatch into that map.

Quick redisplay hack when erasing characters at the end of the line.

Find next `count’ characters started byte point of the specified seed.

  If flags is MB_FIND_NONZERO, we look for non-zero-width multibyte
  characters.

Find previous character started byte point of the specified seed.

  Returned point will be point <= seed.  If flags is MB_FIND_NONZERO,
  we look for non-zero-width multibyte characters.

return the number of bytes parsed from the multibyte sequence starting at src, if a non-L’\0’ wide character was recognized. It returns 0, if a L’\0’ wide character was recognized. It returns (size_t)(-1), if an invalid multibyte sequence was encountered. It returns (size_t)(-2) if it couldn‘t parse a complete multibyte character.

Get readline‘s idea of the screen size. TTY is a file descriptor open

  to the terminal.  If IGNORE_ENV is true, we do not pay attention to the
  values of $LINES and $COLUMNS.  The tests for TERM_STRING_BUFFER being
  non-null serve to check whether or not we have initialized termcap.

Insert the character C at the current location, moving point forward.

  If C introduces a multibyte sequence, we read the whole sequence and
  then insert the multibyte char into the line buffer.

Insert the next typed character verbatim.

Process just-read character C according to isearch context CXT. Return

  -1 if the caller should just free the context and return, 0 if we should
  break out of the loop, and 1 if we should continue to read characters.

Move the cursor from _rl_last_c_pos to NEW, which are buffer indices.

  (Well, when we don't have multibyte characters, _rl_last_c_pos is a
  buffer index.)
  DATA is the contents of the screen line of interest; i.e., where
  the movement is being done.

PWP: move the cursor up or down.

Process just-read character C according to search context CXT. Return -1

  if the caller should abort the search, 0 if we should break out of the
  loop, and 1 if we should continue to read characters.

Perform one search according to CXT, using NONINC_SEARCH_STRING. Return

  -1 if the search should be aborted, any other value means to clean up
  using _rl_nsearch_cleanup ().  Returns 1 if the search was successful,
  0 otherwise.

Write COUNT characters from STRING to the output stream.

Overwrite the character at point (or next COUNT characters) with C.

  If C introduces a multibyte character sequence, read the entire sequence
  before starting the overwrite loop.

This is different from what vi does, so the code‘s not shared. Emacs

  rubout in overwrite mode has one oddity:  it replaces a control
  character that's displayed as two characters (^X) with two spaces.

Read a multibyte-character string whose first character is FIRST into

  the buffer MB of length MLEN.  Returns the last character read, which
  may be FIRST.  Used by the search functions, among others.  Very similar
  to _rl_read_mbchar.

Redisplay the current line after a SIGWINCH is received.

Replace the contents of the line buffer between START and END with

  TEXT.  The operation is undoable.  To replace the entire line in an
  undoable mode, use _rl_replace_text(text, 0, rl_end)

Create a default argument.

Function for the rest of the library to use to set insert/overwrite mode.

Set the mark at POSITION.

Set the history pointer back to the last entry in the history.

Stuff KEY into the front of the input buffer.

  Returns non-zero if successful, zero if there is
  no space left in the buffer.

Is the command C a VI mode text modification command?

Place STRING at the end of the history list. The data field

  is  set to NULL.

Append any necessary closing quote and a separator character to the just-inserted match. If the user has specified that directories should be marked by a trailing `/’, append one of those instead. The default trailing character is a space. Returns the number of characters appended. If NONTRIVIAL_MATCH is set, we test for a symlink (if the OS has them) and don‘t add a suffix for a symlink to a directory. A nontrivial match is one that actually adds to the word being completed. The variable rl_completion_mark_symlink_dirs controls this behavior (it‘s initially set to the what the user has chosen, indicated by the value of _rl_complete_mark_symlink_dirs, but may be modified by an application‘s completion function).

Try and bind the common arrow key prefixes after giving termcap and

  the inputrc file a chance to bind them and create `real' keymaps
  for the arrow key prefix.

Bind some common arrow key sequences in MAP.

Bind the arrow key sequences from the termcap description in MAP.

Find the common prefix of the list of matches, and put it into

  matches[0].

Move to the start of the current line.

Return the history entry at the current position, as determined by

  history_offset.  If there is no entry there, return a NULL pointer.

Delete COUNT characters from the display line.

Display MATCHES, a list of matching filenames in argv format. This handles the simple case — a single match — first. If there is more than one match, we compute the number of strings in the list and the length of the longest string, which will be needed by the display function. If the application wants to handle displaying the list of matches itself, it sets RL_COMPLETION_DISPLAY_MATCHES_HOOK to the address of a function, and we just call it. If we‘re handling the display ourselves, we just call rl_display_match_list. We also check that the list of matches doesn‘t exceed the user-settable threshold, and ask the user if he wants to see the list if there are more matches than RL_COMPLETION_QUERY_ITEMS.

Current implementation:

   \001 (^A) start non-visible characters
   \002 (^B) end non-visible characters
  all characters except \001 and \002 (following a \001) are copied to
  the returned string all characters except those between \001 and
  \002 are assumed to be `visible'.

Compute width of STRING when displayed on screen by print_filename

The user must press "y" or "n". Non-zero return means "y" pressed.

Handle a parser directive. STATEMENT is the line of the directive

  without any leading `$'.

Return the history entry which is logically at OFFSET in the history array.

  OFFSET is relative to history_base.

Search for STRING in the history list. DIR is < 0 for searching

  backwards.  POS is an absolute index into the history list at
  which point to begin searching.

Do an anchored search for string through the history in DIRECTION.

Make the current history item be the one at POS, an absolute index.

  Returns zero if POS is out of range, else non-zero.

Return the amount of space available in the buffer for stuffing

  characters.

Initialize the VISIBLE_LINE and INVISIBLE_LINE arrays, and their associated

  arrays of line break markers.  MINSIZE is the minimum size of VISIBLE_LINE
  and INVISIBLE_LINE; if it is greater than LINE_SIZE, LINE_SIZE is
  increased.  If the lines have already been allocated, this ensures that
  they can hold at least MINSIZE characters.

Insert COUNT characters from STRING to the output stream at column COL.

Make the data from the history entry ENTRY be the contents of the

  current line.  This doesn't do anything with rl_point; the caller
  must set it.

Move history_offset forward to the next history entry, and return

  a pointer to that entry.  If there is no next entry then return a
  NULL pointer.

Search for a line in the history containing STRING. If DIR is < 0, the

  search is backwards through previous entries, else through subsequent
  entries.  Returns 1 if the search was successful, 0 otherwise.

Search non-interactively through the history list. DIR < 0 means to

  search backwards through the history of previous commands; otherwise
  the search is for commands subsequent to the current position in the
  history list.  PCHAR is the character to use for prompting when reading
  the search string; if not specified (0), it defaults to `:'.

Search the history list for STRING starting at absolute history position

  POS.  If STRING begins with `^', the search must match STRING at the
  beginning of a history line, otherwise a full substring match is performed
  for STRING.  DIR < 0 means to search backwards through the history list,
  DIR >= 0 means to search forward.

Invert the current parser state if there is anything on the stack.

Terminate a conditional, popping the value of

  _rl_parsing_conditionalized_out from the stack.

Push _rl_parsing_conditionalized_out, and set parser state based

  on ARGS.

Back up history_offset to the previous history entry, and return

  a pointer to that entry.  If there is no previous entry then return
  a NULL pointer.

Output TO_PRINT to rl_outstream. If VISIBLE_STATS is defined and we

  are using it, check for and output a single character for `special'
  filenames.  Return the number of characters we output.

Return the portion of PATHNAME that should be output when listing

  possible completions.  If we are hacking filename completion, we
  are only interested in the basename, the portion following the
  final slash.  Otherwise, we return what we were passed.  Since
  printing empty strings is not very informative, if we're doing
  filename completion, and the basename is the empty string, we look
  for the previous slash and return the portion following that.  If
  there's no previous slash, we just return what we were passed.
  • _rl_last_c_pos is an absolute cursor position in multibyte locales and a
     buffer index in others.  This macro is used when deciding whether the
     current cursor position is in the middle of a prompt string containing
     invisible characters.
    

Read a line of input. Prompt with PROMPT. An empty PROMPT means

  none.  A return value of NULL means that EOF was encountered.

If this system allows us to look at the values of the regular

  input editing characters, then bind them to their readline
  equivalents, iff the characters are not bound to keymaps.

Initialize the entire state of the world.

Read a line of input from the global rl_instream, doing output on

  the global rl_outstream.
  If rl_prompt is non-null, then that is our prompt.

Redraw the last line of a multi-line prompt that may possibly contain terminal escape sequences. Called with the cursor at column 0 of the line to draw the prompt on.

Filter out duplicates in MATCHES. This frees up the strings in

  MATCHES.

Remove history element WHICH from the history. The removed

  element is returned to you so you can free the line, data,
  and containing structure.

Replace the DATA in the specified history entries, replacing OLD with

  NEW.  WHICH says which one(s) to replace:  WHICH == -1 means to replace
  all of the history entries where entry->data == OLD; WHICH == -2 means
  to replace the `newest' history entry where entry->data == OLD; and
  WHICH >= 0 means to replace that particular history entry's data, as
  long as it matches OLD.

Make the history entry at WHICH have LINE and DATA. This returns

  the old entry so you can dispose of the data.  In the case of an
  invalid WHICH, a NULL pointer is returned.
  • Remember how to undo something. Concatenate some undos if that
     seems right.
    

Backwards compatibility.

Move backward COUNT bytes.

Move backward COUNT characters.

Kill backwards to the start of the line. If DIRECTION is negative, kill

  forwards to the line end instead.

Rubout the word before point, placing it on the kill ring.

Move backward a word. We do what Emacs does. Handles multibyte chars.

Move to the beginning of the line.

Begin a group. Subsequent undos are undone as an atomic operation.

Meta-< goes to the start of the history.

Bind KEY to FUNCTION. Returns non-zero if KEY is out of range.

Bind key sequence KEYSEQ to DEFAULT_FUNC if KEYSEQ is unbound. Right

  now, this is always used to attempt to bind the arrow keys, hence the
  check for rl_vi_movement_mode.

Bind the key sequence represented by the string KEYSEQ to

  FUNCTION.  This makes new keymaps as necessary.  The initial
  place to do bindings is in MAP.

Upcase the first letter, downcase the rest.

The meaty function.

  Change the case of COUNT words, performing OP on them.
  OP is one of UpCase, DownCase, or CapCase.
  If a negative argument is given, leave point where it started,
  otherwise, leave it where it moves to.

Clean up the terminal and readline state after catching a signal, before

  resending it to the calling application.

How to clear things from the "echo-area".

Clear any pending input pushed with rl_execute_next()

C-l typed to a line without quoting clears the screen, and then reprints

  the prompt and the current input line.  Given a numeric arg, redraw only
  the current line.

Complete the word at or before point. You have supplied the function

  that does the initial simple matching selection algorithm (see
  rl_completion_matches ()).  The default is to do filename completion.

Complete the word at or before point.

  WHAT_TO_DO says what to do with the completion.
  `?' means list the possible completions.
  TAB means do standard completion.
  `*' means insert all of the possible completions.
  `!' means to do standard completion, and list all possible completions if
  there is more than one.
  `@' means to do standard completion, and list all possible completions if
  there is more than one and partial completion is not possible.

Return an array of (char *) which is a list of completions for TEXT.

  If there are no completions, return a NULL pointer.
  The first entry in the returned array is the substitution for TEXT.
  The remaining entries are the possible completions.
  The array is terminated with a NULL pointer.

  ENTRY_FUNCTION is a function of two args, and returns a (char *).
    The first argument is TEXT.
    The second is a state argument it should be zero on the first call, and
    non-zero on subsequent calls.  It returns a NULL pointer to the caller
    when there are no more matches.

Move to the start of the next line.

Delete the character under the cursor. Given a numeric argument,

  kill that many characters instead.

Delete all spaces and tabs around point.

Like the tcsh editing function delete-char-or-list. The eof character

  is caught before this is invoked, so this really does the same thing as
  delete-char-or-list-or-eof, as long as it's bound to the eof character.

Delete the string between FROM and TO. FROM is inclusive, TO is not.

  Returns the number of characters deleted.

Restore the terminal‘s normal settings and modes.

Start a numeric argument with initial value KEY

Handle C-u style numeric args, as well as M—, and M-digits.

Ring the terminal bell.

A convenience function for displaying a list of strings in

  columnar format on readline's output stream.  MATCHES is the list
  of strings, in argv format, LEN is the number of strings in MATCHES,
  and MAX is the length of the longest string in MATCHES.

Display the current state of the search in the echo-area.

  SEARCH_STRING contains the string that is being searched for,
  DIRECTION is zero for forward, or non-zero for reverse,
  WHERE is the history list number of the current line.  If it is
  -1, then this line is the starting one.

What to do for some uppercase characters, like meta characters,

  and some characters appearing in emacs_ctlx_keymap.  This function
  is just a stub, you bind keys to it and the code in _rl_dispatch ()
  is special cased.

Lowercase the word at point.

Meta-> goes to the end of the history. (The current line).

Move to the end of the line.

End an undo group started with rl_begin_undo_group ().

Exchange the position of mark and point.

Make C be the next command to be executed.

*

  • Expand the prompt string into the various display components, if
  • necessary.

*

  • local_prompt = expanded last line of string in rl_display_prompt
  • (portion after the final newline)
  • local_prompt_prefix = portion before last newline of rl_display_prompt,
  • expanded via expand_prompt
  • prompt_visible_length = number of visible characters in local_prompt
  • prompt_prefix_length = number of visible characters in local_prompt_prefix

*

  • This function is called once per call to readline(). It may also be
  • called arbitrarily to expand the primary prompt.

*

  • The return value is the number of visible characters on the last line
  • of the (possibly multi-line) prompt.

*

Increase the size of RL_LINE_BUFFER until it has enough space to hold

  LEN characters.

Okay, now we write the entry_function for filename completion. In the general case. Note that completion in the shell is a little different because of all the pathnames that must be followed when looking up the completion for a command.

Actually update the display, period.

Backwards compatibility.

Move forward COUNT bytes.

Move forward COUNT characters.

Search forwards through the history looking for a string which is typed

  interactively.  Start with the current line.

Move forward a word. We do what Emacs does. Handles multibyte chars.

Return the function (or macro) definition which would be invoked via

  KEYSEQ if executed in MAP.  If MAP is NULL, then the current keymap is
  used.  TYPE, if non-NULL, is a pointer to an int which will receive the
  type of the object pointed to.  One of ISFUNC (function), ISKMAP (keymap),
  or ISMACR (macro).

Bind the key sequence represented by the string KEYSEQ to

  the arbitrary pointer DATA.  TYPE says what kind of data is
  pointed to by DATA, right now this can be a function (ISFUNC),
  a macro (ISMACR), or a keymap (ISKMAP).  This makes new keymaps
  as necessary.  The initial place to do bindings is in MAP.

Get a key from the buffer of characters to be read.

  Return the key in KEY.
  Result is KEY if there was a key, or 0 if there wasn't.

Move down to the next history line.

Get the previous item out of our interactive history, making it the current

  line.  If there is no previous history, just ding.

Initialize readline (and terminal if not already).

Turn the current line into a comment in shell history.

  A K*rn shell style function.

Insert a string of text into the line at point. This is the only

  way that you should do insertion.  _rl_insert_char () calls this
  function.  Returns the number of characters inserted.

Kill the whole line, no matter where point is.

Kill from here to the end of the line. If DIRECTION is negative, kill

  back to the line start instead.

The way to kill something. This appends or prepends to the last

  kill, if the last command was a kill command.  if FROM is less
  than TO, then the text is appended, otherwise prepended.  If the
  last command was not a kill command, then a new slot is made for
  this kill.

Delete the word at point, saving the text in the kill ring.

Perhaps put back the current line if it has changed.

Save the current line in _rl_saved_line_for_history.

Restore the _rl_saved_line_for_history if there is one.

Save an undo entry for the text from START to END.

What to do when a NEWLINE is pressed. We accept the whole line.

  KEY is the key that invoked this command.  I guess it could have
  meaning in the future.

Search forward through the history list for a string. If the vi-mode

  code calls this, KEY will be `?'.

Reverse search the history list for a string. If the vi-mode code

  calls this, KEY will be `/'.

Tell the update routines that we have moved onto a new (empty) line.

Tell the update routines that we have moved onto a new line with the

  prompt already displayed.  Code originally from the version of readline
  distributed with CLISP.  rl_expand_prompt must have already been called
  (explicitly or implicitly).  This still doesn't work exactly right.

Toggle overwrite mode. A positive explicit argument selects overwrite

  mode.  A negative or zero explicit argument selects insert mode.

Read the binding command from STRING and perform it.

  A key binding command looks like: Keyname: function-name\0,
  a variable binding command looks like: set variable value.
  A new-style keybinding looks like "\C-x\C-x": exchange-point-and-mark.

List the possible completions. See description of rl_complete ().

Re-read the current keybindings file.

Do key bindings from a file. If FILENAME is NULL it defaults

  to the first non-null filename from this list:
    1. the filename used for the previous call
    2. the value of the shell variable `INPUTRC'
    3. ~/.inputrc
    4. /etc/inputrc
  If the file existed and could be opened and read, 0 is returned,
  otherwise errno is returned.

Read a key, including pending input.

Basic redisplay algorithm.

Clear the current line. Numeric argument to C-l does this.

Replace the current line buffer contents with TEXT. If CLEAR_UNDO is

  non-zero, we free the current undo list.

Search backwards through the history looking for a string which is typed

  interactively.  Start with the current line.

Revert the current line to its previous state.

Rubout the character behind point.

Delete the character under the cursor, unless the insertion

  point is at the end of the line, in which case the character
  behind the cursor is deleted.  COUNT is obeyed and may be used
  to delete forward or backward that many characters.

Search through the history looking for an interactively typed string.

  This is analogous to i-search.  We start the search in the current line.
  DIRECTION is which direction to search; >= 0 means forward, < 0 means
  backwards.

A bindable command to set the mark.

Set up the prompt and expand it. Called from readline() and

  rl_callback_handler_install ().

Add KEY to the buffer of characters to be read. Returns 1 if the

  character was stuffed correctly; 0 otherwise.

Insert a tab character.

A function for simple tilde expansion.

Transpose the characters at point. If point is at the end of the line,

  then transpose the characters before point.

Transpose the words at point. If point is at the end of the line,

  transpose the two words before point.

New public way to set the system default editing chars to their readline

  equivalents.

Rebind all of the tty special chars that readline worries about back

  to self-insert.  Call this before saving the current terminal special
  chars with save_tty_chars().  This only works on POSIX termios or termio
  systems.

Do some undoing of things that were done.

This deletes one filename component in a Unix pathname. That is, it

  deletes backward to directory separator (`/') or whitespace.

Here is C-u doing what Unix does. You don‘t have to use these key-bindings. We have a choice of killing the entire line, or killing from where we are to the start of the line. We choose the latter, because if you are a Unix weenie, then you haven‘t backspaced into the line at all, and if you aren‘t, then you know what you are doing.

This does what C-w does in Unix. We can‘t prevent people from

  using behaviour that they expect.

Uppercase the word at point.

A completion function for usernames.

  TEXT contains a partial username preceded by a random
  character (usually `~').

This is a NOOP until the rest of Vi-mode is working.

Switching from one mode to the other really just involves

  switching keymaps.

Yank back the last killed text. This ignores arguments.

Yank the COUNTth argument from the previous history line.

Yank the COUNTh argument from the previous history line, skipping

  HISTORY_SKIP lines before looking for the `previous line'.

If the last command was yank, or yank_pop, and the text just

  before point is identical to the current kill item, then
  delete that text from the line, rotate the index down, and
  yank back some other text.

Set default values for readline word completion. These are the variables

  that application completion functions can change or inspect.

Set the environment variables LINES and COLUMNS to lines and cols,

  respectively.

Clear to the end of the line using spaces. COUNT is the minimum

  number of character spaces to clear,

Return the character which best describes FILENAME.

    `@' for symbolic links
    `/' for directories
    `*' for executables
    `=' for sockets
    `|' for FIFOs
    `%' for character special devices
    `#' for block special devices

Stifle the history list, remembering only MAX number of lines.

Undo the next thing in the list. Return 0 if there

  is nothing to undo, or non-zero if there was.

Stop stifling the history. This returns the previous maximum

  number of history entries.  The value is positive if the history
  was stifled,  negative if it wasn't.

PWP: update_line() is based on finding the middle difference of each

  line on the screen; vis:

            /old first difference
 /beginning of line   |        /old last same       /old EOL
 v          v         v         v

old: eddie> Oh, my little gruntle-buggy is to me, as lurgid as new: eddie> Oh, my little buggy says to me, as lurgid as

 ^          ^   ^           ^
 \beginning of line   |  \new last same    \new end of line
            \new first difference

  All are character pointers for the sake of speed.  Special cases for
  no differences, as well as for end of line additions must be handled.

  Could be made even smarter, but this works well enough

Returns the magic number which says what history element we are

  looking at now.  In this implementation, it returns history_offset.

[Validate]