manpagez: man pages & more
info rlman
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3 Readline Variables

These variables are available to function writers.

Variable: char * rl_line_buffer

This is the line gathered so far. You are welcome to modify the contents of the line, but see Allowing Undoing. The function rl_extend_line_buffer is available to increase the memory allocated to rl_line_buffer.

Variable: int rl_point

The offset of the current cursor position in rl_line_buffer (the point).

Variable: int rl_end

The number of characters present in rl_line_buffer. When rl_point is at the end of the line, rl_point and rl_end are equal.

Variable: int rl_mark

The mark (saved position) in the current line. If set, the mark and point define a region.

Variable: int rl_done

Setting this to a non-zero value causes Readline to return the current line immediately.

Variable: int rl_num_chars_to_read

Setting this to a positive value before calling readline() causes Readline to return after accepting that many characters, rather than reading up to a character bound to accept-line.

Variable: int rl_pending_input

Setting this to a value makes it the next keystroke read. This is a way to stuff a single character into the input stream.

Variable: int rl_dispatching

Set to a non-zero value if a function is being called from a key binding; zero otherwise. Application functions can test this to discover whether they were called directly or by Readline’s dispatching mechanism.

Variable: int rl_erase_empty_line

Setting this to a non-zero value causes Readline to completely erase the current line, including any prompt, any time a newline is typed as the only character on an otherwise-empty line. The cursor is moved to the beginning of the newly-blank line.

Variable: char * rl_prompt

The prompt Readline uses. This is set from the argument to readline(), and should not be assigned to directly. The rl_set_prompt() function (see section Redisplay) may be used to modify the prompt string after calling readline().

Variable: char * rl_display_prompt

The string displayed as the prompt. This is usually identical to rl_prompt, but may be changed temporarily by functions that use the prompt string as a message area, such as incremental search.

Variable: int rl_already_prompted

If an application wishes to display the prompt itself, rather than have Readline do it the first time readline() is called, it should set this variable to a non-zero value after displaying the prompt. The prompt must also be passed as the argument to readline() so the redisplay functions can update the display properly. The calling application is responsible for managing the value; Readline never sets it.

Variable: const char * rl_library_version

The version number of this revision of the library.

Variable: int rl_readline_version

An integer encoding the current version of the library. The encoding is of the form 0xMMmm, where MM is the two-digit major version number, and mm is the two-digit minor version number. For example, for Readline-4.2, rl_readline_version would have the value 0x0402.

Variable: int rl_gnu_readline_p

Always set to 1, denoting that this is GNU readline rather than some emulation.

Variable: const char * rl_terminal_name

The terminal type, used for initialization. If not set by the application, Readline sets this to the value of the TERM environment variable the first time it is called.

Variable: const char * rl_readline_name

This variable is set to a unique name by each application using Readline. The value allows conditional parsing of the inputrc file (see section Conditional Init Constructs).

Variable: FILE * rl_instream

The stdio stream from which Readline reads input. If NULL, Readline defaults to stdin.

Variable: FILE * rl_outstream

The stdio stream to which Readline performs output. If NULL, Readline defaults to stdout.

Variable: int rl_prefer_env_winsize

If non-zero, Readline gives values found in the LINES and COLUMNS environment variables greater precedence than values fetched from the kernel when computing the screen dimensions.

Variable: rl_command_func_t * rl_last_func

The address of the last command function Readline executed. May be used to test whether or not a function is being executed twice in succession, for example.

Variable: rl_hook_func_t * rl_startup_hook

If non-zero, this is the address of a function to call just before readline prints the first prompt.

Variable: rl_hook_func_t * rl_pre_input_hook

If non-zero, this is the address of a function to call after the first prompt has been printed and just before readline starts reading input characters.

Variable: rl_hook_func_t * rl_event_hook

If non-zero, this is the address of a function to call periodically when Readline is waiting for terminal input. By default, this will be called at most ten times a second if there is no keyboard input.

Variable: rl_getc_func_t * rl_getc_function

If non-zero, Readline will call indirectly through this pointer to get a character from the input stream. By default, it is set to rl_getc, the default Readline character input function (see section Character Input).

Variable: rl_voidfunc_t * rl_redisplay_function

If non-zero, Readline will call indirectly through this pointer to update the display with the current contents of the editing buffer. By default, it is set to rl_redisplay, the default Readline redisplay function (see section Redisplay).

Variable: rl_vintfunc_t * rl_prep_term_function

If non-zero, Readline will call indirectly through this pointer to initialize the terminal. The function takes a single argument, an int flag that says whether or not to use eight-bit characters. By default, this is set to rl_prep_terminal (see section Terminal Management).

Variable: rl_voidfunc_t * rl_deprep_term_function

If non-zero, Readline will call indirectly through this pointer to reset the terminal. This function should undo the effects of rl_prep_term_function. By default, this is set to rl_deprep_terminal (see section Terminal Management).

Variable: Keymap rl_executing_keymap

This variable is set to the keymap (see section Selecting a Keymap) in which the currently executing readline function was found.

Variable: Keymap rl_binding_keymap

This variable is set to the keymap (see section Selecting a Keymap) in which the last key binding occurred.

Variable: char * rl_executing_macro

This variable is set to the text of any currently-executing macro.

Variable: int rl_readline_state

A variable with bit values that encapsulate the current Readline state. A bit is set with the RL_SETSTATE macro, and unset with the RL_UNSETSTATE macro. Use the RL_ISSTATE macro to test whether a particular state bit is set. Current state bits include:


Readline has not yet been called, nor has it begun to intialize.


Readline is initializing its internal data structures.


Readline has completed its initialization.


Readline has modified the terminal modes to do its own input and redisplay.


Readline is reading a command from the keyboard.


Readline is reading more input after reading the meta-prefix character.


Readline is dispatching to a command.


Readline is reading more input while executing an editing command.


Readline is performing an incremental history search.


Readline is performing a non-incremental history search.


Readline is searching backward or forward through the history for a string.


Readline is reading a numeric argument.


Readline is currently getting its input from a previously-defined keyboard macro.


Readline is currently reading characters defining a keyboard macro.


Readline is in overwrite mode.


Readline is performing word completion.


Readline is currently executing the readline signal handler.


Readline is performing an undo.


Readline has input pending due to a call to rl_execute_next().


Readline has saved the values of the terminal’s special characters.


Readline is currently using the alternate (callback) interface (see section Alternate Interface).


Readline is reading the argument to a vi-mode "motion" command.


Readline is reading a multiple-keystroke command.


Readline has entered vi command (movement) mode at least one time during the current call to readline().


Readline has read a key sequence bound to accept-line and is about to return the line to the caller.

Variable: int rl_explicit_arg

Set to a non-zero value if an explicit numeric argument was specified by the user. Only valid in a bindable command function.

Variable: int rl_numeric_arg

Set to the value of any numeric argument explicitly specified by the user before executing the current Readline function. Only valid in a bindable command function.

Variable: int rl_editing_mode

Set to a value denoting Readline’s current editing mode. A value of 1 means Readline is currently in emacs mode; 0 means that vi mode is active.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]
© 2000-2018
Individual documents may contain additional copyright information.