Struct linefeed::reader::Reader [] [src]

pub struct Reader<Term: Terminal> { /* fields omitted */ }

Interactively reads user input

Methods

impl Reader<DefaultTerminal>
[src]

[src]

Creates a new Reader with the given application name.

application is a string containing the name of the application. This can be used in user configurations to specify behavior for particular applications.

The platform-dependent default terminal interface is used.

impl<Term: Terminal> Reader<Term>
[src]

[src]

Creates a new Reader instance with a particular terminal implementation.

To use the platform-dependent default terminal interface, call Reader::new instead.

[src]

Interactively reads a line from stdin.

If end-of-file occurs, returns ReadResult::Eof.

If a reported signal (see set_report_signal) is received, it is returned as ReadResult::Signal(_).

Otherwise, user input is returned as ReadResult::Input(_).

[src]

Returns the current buffer.

[src]

Returns the "backup" buffer.

When the user is currently editing a history entry, the backup buffer contains the original user input.

[src]

Returns the command Category of the most recently executed command.

Some commands may use this to influence behavior of repeated commands.

[src]

Sets the buffer to the given value. The cursor is moved to the end of the buffer.

[src]

Returns the current position of the cursor.

[src]

Sets the cursor to the given position within the buffer.

[src]

Returns whether a numerical argument was explicitly supplied by the user.

[src]

Returns the current input sequence.

[src]

Sets the prompt that will be displayed when read_line is called.

Note

If prompt contains any terminal escape sequences (e.g. color codes), such escape sequences should be immediately preceded by the character '\x01' and immediately followed by the character '\x02'.

[src]

Returns an iterator over bound sequences

[src]

Binds a sequence to a command.

Returns the previously bound command.

[src]

Binds a sequence to a command, if and only if the given sequence is not already bound to a command.

Returns true if a new binding was created.

[src]

Removes a binding for the given sequence.

Returns the previously bound command.

[src]

Defines a named function to which sequences may be bound.

The name should contain no spaces, with words separated by hyphens, and all lowercase.

Returns the function previously defined with the same name.

[src]

Removes a function defined with the given name.

Returns the defined function.

[src]

Adds a line to history.

If the maximum size is reached, the oldest entry is removed.

[src]

Returns an iterator over history entries

[src]

Returns the index into history currently being edited.

If the user is not editing a line of history, None is returned.

[src]

Returns the current number of history entries.

[src]

Removes the nth history entry

Panics

If n is out of bounds.

[src]

Truncates history to the most recent n entries.

If there are fewer than n entries in history, this has no effect.

[src]

Selects the history entry currently being edited by the user.

Setting the entry to None will result in editing the input buffer.

[src]

Returns a reference to the current completer instance

[src]

Replaces the current completer, returning the previous instance.

[src]

Returns the current set of completions.

The result is only not None when the most recent command executed was one operating on completion sets.

[src]

Sets the current set of completions.

This completion set is accessed by commands such as complete and possible-completions.

This set will only remain active until the end of the next non-completion command's execution. Therefore, any Function that uses this method must be of the Complete category.

Moves the cursor to the given position, waits for BLINK_TIMEOUT_MS (or until next user input), then restores the original cursor position.

[src]

Deletes a range from the buffer; the cursor is moved to the end of the given range.

[src]

Deletes a range from the buffer and adds the removed text to the kill ring.

[src]

Transposes two regions of the buffer, src and dest. The cursor is placed at the end of the new location of src.

Panics

If src and dest overlap.

[src]

Insert text from the front of the kill ring at the current cursor position. The cursor is placed at the end of the new text.

[src]

Rotates the kill ring and replaces yanked text with the new front.

If the previous operation was not yank, this has no effect.

[src]

Insert a given character at the current cursor position n times.

[src]

Insert a string at the current cursor position.

[src]

Replaces a range in the buffer and redraws. Cursor is placed at the start of the range

[src]

Replaces a range in the buffer and redraws. Cursor is placed at the end of the new string

[src]

Evaluates a series of configuration directives.

[src]

Evaluates a single configuration directive.

impl<Term: Terminal> Reader<Term>
[src]

Variables and other configurable parameters

[src]

Returns the application name

[src]

Sets the application name

[src]

Returns the value of the named variable or None if no such variable exists.

[src]

Sets the value of the named variable and returns the previous value.

If name does not refer to a variable or the value is not a valid value for the variable, None is returned.

[src]

Returns an iterator over stored variables.

[src]

Returns the maximum number of history entries.

Note

Not to be confused with history_len which returns the current number of stored history entries.

[src]

Sets the maximum number of history entries. If n is less than the current number of history entries, history will be truncated to the most recent n entries.

Returns whether to "blink" matching opening parenthesis character when a closing parenthesis character is entered.

The default value is false.

Sets the blink-matching-paren variable.

[src]

Returns whether linefeed will catch certain signals.

[src]

Sets whether linefeed will catch certain signals.

This setting is true by default. It can be disabled to allow the host program to handle signals itself.

[src]

Returns whether the given Signal is ignored.

[src]

Sets whether the given Signal will be ignored.

[src]

Returns whether the given Signal is to be reported.

[src]

Sets whether to report the given Signal.

When a reported signal is received via the terminal, it will be returned from Reader::read_line as Ok(Signal(signal)).

[src]

Returns whether Tab completion is disabled.

The default value is false.

[src]

Sets the disable-completion variable.

[src]

When certain control characters are pressed, a character sequence equivalent to this character will be echoed.

The default value is true.

[src]

Sets the echo-control-characters variable.

[src]

Returns the character, if any, that is appended to a successful completion.

[src]

Sets the character, if any, that is appended to a successful completion.

[src]

Returns the width of completion listing display.

If this value is greater than the terminal width, terminal width is used instead.

The default value is equal to usize::max_value().

[src]

Sets the completion-display-width variable.

[src]

Returns the minimum number of completion items that require user confirmation before listing.

The default value is 100.

[src]

Sets the completion-query-items variable.

[src]

Returns the timeout to wait for further user input when an ambiguous sequence has been entered. If the value is None, wait is indefinite.

The default value is equal to KEYSEQ_TIMEOUT_MS.

[src]

Sets the keyseq-timeout variable.

[src]

Returns whether to list possible completions one page at a time.

The default value is true.

[src]

Sets the page-completions variable.

[src]

Returns whether to list completions horizontally, rather than down the screen.

The default value is false.

[src]

Sets the print-completions-horizontally variable.

[src]

Returns the set of characters that delimit strings.

[src]

Sets the set of characters that delimit strings.

[src]

Returns the set of characters that indicate a word break.

[src]

Sets the set of characters that indicate a word break.

[src]

Creaes a sender object that allows other threads to log messages while a prompt is open, without causing display errors. The Reader handles checking the buffer, so unless read_line or a similar function is running in the Reader, the messages sent will not be printed.

[src]

Returns the interval at which Reader checks for log messages while waiting for user input.

The default value is POLL_LOG_INTERVAL_MS milliseconds.

[src]

Sets the interval at which Reader checks for log messages while waiting for user input.