class LineInputEditor

Defined at line 166 of file ../../src/lib/line_input/line_input.h

Implementation of LineInput that implements the editing state. Output is still abstract to

allow for output to different places.

Public Methods

void LineInputEditor (AcceptCallback accept_cb, const std::string & prompt)

Defined at line 32 of file ../../src/lib/line_input/line_input.cc

void ~LineInputEditor ()

Defined at line 38 of file ../../src/lib/line_input/line_input.cc

void SetAutocompleteCallback (AutocompleteCallback cb)

LineInput implementation.

Defined at line 43 of file ../../src/lib/line_input/line_input.cc

void SetChangeCallback (ChangeCallback cb)

Defined at line 47 of file ../../src/lib/line_input/line_input.cc

void SetCancelCallback (CancelCallback cb)

Defined at line 49 of file ../../src/lib/line_input/line_input.cc

void SetEofCallback (EofCallback cb)

Defined at line 51 of file ../../src/lib/line_input/line_input.cc

void SetMaxCols (size_t max)

Defined at line 53 of file ../../src/lib/line_input/line_input.cc

const std::string & GetLine ()

Defined at line 55 of file ../../src/lib/line_input/line_input.cc

const std::deque<std::string> & GetHistory ()

Defined at line 61 of file ../../src/lib/line_input/line_input.cc

void OnInput (char c)

Defined at line 63 of file ../../src/lib/line_input/line_input.cc

void AddToHistory (const std::string & line)

Defined at line 157 of file ../../src/lib/line_input/line_input.cc

void Hide (InterruptHandlingBehavior behavior)

Defined at line 174 of file ../../src/lib/line_input/line_input.cc

size_t pos ()

Defined at line 186 of file ../../src/lib/line_input/line_input.h

bool in_reverse_history_mode ()

Defined at line 188 of file ../../src/lib/line_input/line_input.h

void Show ()

Defined at line 188 of file ../../src/lib/line_input/line_input.cc

size_t reverse_history_index ()

Defined at line 189 of file ../../src/lib/line_input/line_input.h

void SetCurrentInput (const std::string & input)

Defined at line 195 of file ../../src/lib/line_input/line_input.cc

std::string GetReverseHistoryPrompt ()

Exposed for testing purposes.

Defined at line 646 of file ../../src/lib/line_input/line_input.cc

std::string GetReverseHistorySuggestion ()

Defined at line 657 of file ../../src/lib/line_input/line_input.cc

Protected Methods

void EnsureTerminalMode (TerminalMode mode)

Sets the terminal mode to the given value if necessary.

Defined at line 211 of file ../../src/lib/line_input/line_input.h

void Write (const std::string & data)

Abstract output function, overridden by a derived class to output to screen.

std::string & mutable_cur_line ()

Helper to return the current line of text as an editable string. This uses the overlay provided

by editing_history and falls back to promoting the value from persistent_history_.

Use the const GetLine() on the base class to avoid the promotion if the returned value will

not be modified.

Defined at line 221 of file ../../src/lib/line_input/line_input.h

void set_pos (size_t pos)

Useful for testing.

Defined at line 230 of file ../../src/lib/line_input/line_input.h

const std::string & prompt ()

Defined at line 232 of file ../../src/lib/line_input/line_input.h

void set_prompt (std::string prompt)

Defined at line 233 of file ../../src/lib/line_input/line_input.h

Enumerations

enum TerminalMode
Name Value Comments
kOriginalMode 0

The original mode of the terminal when we started. Used for putting it back when we exit.

kRawInOutMode 1

Raw input and output. Used for active line input.

kRawInMode 2

Raw input only. Output will be formatted as normal in a terminal. Used when the input is
hidden so the app may print with normal behavior but input is still raw. This prevents
echoing input to the terminal when we're not processing it, and Control-C from exiting the
app out from under us.

Defined at line 196 of file ../../src/lib/line_input/line_input.h