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

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

Interactively reads user input

Methods

impl Reader<DefaultTerminal>
[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]

Creates a new Reader instance with a particular terminal implementation.

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

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(_).

Returns the current buffer.

Returns the "backup" buffer.

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

Returns the command Category of the most recently executed command.

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

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

Returns the current position of the cursor.

Sets the cursor to the given position within the buffer.

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

Returns the current input sequence.

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'.

Important traits for BindingIter<'a>

Returns an iterator over bound sequences

Binds a sequence to a command.

Returns the previously bound command.

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.

Removes a binding for the given sequence.

Returns the previously bound command.

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.

Removes a function defined with the given name.

Returns the defined function.

Adds a line to history.

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

Important traits for HistoryIter<'a>

Returns an iterator over history entries

Returns the index into history currently being edited.

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

Returns the current number of history entries.

Removes the nth history entry

Panics

If n is out of bounds.

Truncates history to the most recent n entries.

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

Selects the history entry currently being edited by the user.

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

Returns a reference to the current completer instance

Replaces the current completer, returning the previous instance.

Returns the current set of completions.

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

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.

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

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

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.

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.

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

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

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

Insert a string at the current cursor position.

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

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

Evaluates a series of configuration directives.

Evaluates a single configuration directive.

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

Variables and other configurable parameters

Returns the application name

Sets the application name

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

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.

Important traits for VariableIter<'a, Term>

Returns an iterator over stored variables.

Returns the maximum number of history entries.

Note

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

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.

Returns whether linefeed will catch certain signals.

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.

Returns whether the given Signal is ignored.

Sets whether the given Signal will be ignored.

Returns whether the given Signal is to be reported.

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)).

Returns whether Tab completion is disabled.

The default value is false.

Sets the disable-completion variable.

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

The default value is true.

Sets the echo-control-characters variable.

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

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

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().

Sets the completion-display-width variable.

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

The default value is 100.

Sets the completion-query-items variable.

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.

Sets the keyseq-timeout variable.

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

The default value is true.

Sets the page-completions variable.

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

The default value is false.

Sets the print-completions-horizontally variable.

Returns the set of characters that delimit strings.

Sets the set of characters that delimit strings.

Returns the set of characters that indicate a word break.

Sets the set of characters that indicate a word break.

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.

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

The default value is POLL_LOG_INTERVAL_MS milliseconds.

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

Trait Implementations

Auto Trait Implementations

impl<Term> !Send for Reader<Term>

impl<Term> !Sync for Reader<Term>