LLDB mainline
|
Instances of Editline provide an abstraction over libedit's EditLine facility. More...
#include <Editline.h>
Public Member Functions | |
Editline (const char *editor_name, FILE *input_file, lldb::LockableStreamFileSP output_stream_sp, lldb::LockableStreamFileSP error_stream_sp, bool color) | |
~Editline () | |
void | UseColor (bool use_color) |
Sets if editline should use color. | |
void | SetPrompt (const char *prompt) |
Sets a string to be used as a prompt, or combined with a line number to form a prompt. | |
void | SetContinuationPrompt (const char *continuation_prompt) |
Sets an alternate string to be used as a prompt for the second line and beyond in multi-line editing scenarios. | |
void | TerminalSizeChanged () |
Call when the terminal size changes. | |
const char * | GetPrompt () |
Returns the prompt established by SetPrompt. | |
uint32_t | GetCurrentLine () |
Returns the index of the line currently being edited. | |
bool | Interrupt () |
Interrupt the current edit as if ^C was pressed. | |
bool | Cancel () |
Cancel this edit and obliterate all trace of it. | |
void | SetSuggestionCallback (SuggestionCallbackType callback) |
Register a callback for autosuggestion. | |
void | SetRedrawCallback (RedrawCallbackType callback) |
Register a callback for redrawing the statusline. | |
void | SetAutoCompleteCallback (CompleteCallbackType callback) |
Register a callback for the tab key. | |
void | SetIsInputCompleteCallback (IsInputCompleteCallbackType callback) |
Register a callback for testing whether multi-line input is complete. | |
void | SetFixIndentationCallback (FixIndentationCallbackType callback, const char *indent_chars) |
Register a callback for determining the appropriate indentation for a line when creating a newline. | |
void | SetPromptAnsiPrefix (std::string prefix) |
void | SetPromptAnsiSuffix (std::string suffix) |
void | SetSuggestionAnsiPrefix (std::string prefix) |
void | SetSuggestionAnsiSuffix (std::string suffix) |
bool | GetLine (std::string &line, bool &interrupted) |
Prompts for and reads a single line of user input. | |
bool | GetLines (int first_line_number, StringList &lines, bool &interrupted) |
Prompts for and reads a multi-line batch of user input. | |
void | PrintAsync (lldb::LockableStreamFileSP stream_sp, const char *s, size_t len) |
StringList | GetInputAsStringList (int line_count=UINT32_MAX) |
Convert the current input lines into a UTF8 StringList. | |
size_t | GetTerminalWidth () |
size_t | GetTerminalHeight () |
void | Refresh () |
Static Public Member Functions | |
static Editline * | InstanceFor (::EditLine *editline) |
Uses the user data storage of EditLine to retrieve an associated instance of Editline. | |
static void | DisplayCompletions (Editline &editline, llvm::ArrayRef< CompletionResult::Completion > results) |
Private Member Functions | |
void | SetBaseLineNumber (int line_number) |
Sets the lowest line number for multi-line editing sessions. | |
std::string | PromptForIndex (int line_index) |
Returns the complete prompt by combining the prompt or continuation prompt with line numbers as appropriate. | |
void | SetCurrentLine (int line_index) |
Sets the current line index between line edits to allow free movement between lines. | |
size_t | GetPromptWidth () |
Determines the width of the prompt in characters. | |
bool | IsEmacs () |
Returns true if the underlying EditLine session's keybindings are Emacs-based, or false if they are VI-based. | |
bool | IsOnlySpaces () |
Returns true if the current EditLine buffer contains nothing but spaces, or is empty. | |
int | GetLineIndexForLocation (CursorLocation location, int cursor_row) |
Helper method used by MoveCursor to determine relative line position. | |
void | MoveCursor (CursorLocation from, CursorLocation to) |
Move the cursor from one well-established location to another using relative line positioning and absolute column positioning. | |
void | DisplayInput (int firstIndex=0) |
Clear from cursor position to bottom of screen and print input lines including prompts, optionally starting from a specific line. | |
int | CountRowsForLine (const EditLineStringType &content) |
Counts the number of rows a given line of content will end up occupying, taking into account both the preceding prompt and a single trailing space occupied by a cursor when at the end of the line. | |
void | SaveEditedLine () |
Save the line currently being edited. | |
unsigned char | RecallHistory (HistoryOperation op) |
Replaces the current multi-line session with the next entry from history. | |
int | GetCharacter (EditLineGetCharType *c) |
Character reading implementation for EditLine that supports our multi-line editing trickery. | |
const char * | Prompt () |
Prompt implementation for EditLine. | |
unsigned char | BreakLineCommand (int ch) |
Line break command used when meta+return is pressed in multi-line mode. | |
unsigned char | EndOrAddLineCommand (int ch) |
Command used when return is pressed in multi-line mode. | |
unsigned char | DeleteNextCharCommand (int ch) |
Delete command used when delete is pressed in multi-line mode. | |
unsigned char | DeletePreviousCharCommand (int ch) |
Delete command used when backspace is pressed in multi-line mode. | |
unsigned char | PreviousLineCommand (int ch) |
Line navigation command used when ^P or up arrow are pressed in multi-line mode. | |
unsigned char | NextLineCommand (int ch) |
Line navigation command used when ^N or down arrow are pressed in multi-line mode. | |
unsigned char | PreviousHistoryCommand (int ch) |
History navigation command used when Alt + up arrow is pressed in multi-line mode. | |
unsigned char | NextHistoryCommand (int ch) |
History navigation command used when Alt + down arrow is pressed in multi-line mode. | |
unsigned char | BufferStartCommand (int ch) |
Buffer start command used when Esc < is typed in multi-line emacs mode. | |
unsigned char | BufferEndCommand (int ch) |
Buffer end command used when Esc > is typed in multi-line emacs mode. | |
unsigned char | TabCommand (int ch) |
Context-sensitive tab insertion or code completion command used when the tab key is typed. | |
unsigned char | ApplyAutosuggestCommand (int ch) |
Apply autosuggestion part in gray as editline. | |
unsigned char | TypedCharacter (int ch) |
Command used when a character is typed. | |
unsigned char | FixIndentationCommand (int ch) |
Respond to normal character insertion by fixing line indentation. | |
unsigned char | RevertLineCommand (int ch) |
Revert line command used when moving between lines. | |
void | ConfigureEditor (bool multiline) |
Ensures that the current EditLine instance is properly configured for single or multi-line editing. | |
bool | CompleteCharacter (char ch, EditLineGetCharType &out) |
void | ApplyTerminalSizeChange () |
void | AddFunctionToEditLine (const EditLineCharType *command, const EditLineCharType *helptext, EditlineCommandCallbackType callbackFn) |
void | SetEditLinePromptCallback (EditlinePromptCallbackType callbackFn) |
void | SetGetCharacterFunction (EditlineGetCharCallbackType callbackFn) |
Instances of Editline provide an abstraction over libedit's EditLine facility.
Both single- and multi-line editing are supported.
Definition at line 155 of file Editline.h.
Editline::Editline | ( | const char * | editor_name, |
FILE * | input_file, | ||
lldb::LockableStreamFileSP | output_stream_sp, | ||
lldb::LockableStreamFileSP | error_stream_sp, | ||
bool | color ) |
Definition at line 1508 of file Editline.cpp.
References lldb_private::line_editor::Complete, lldb_private::line_editor::EditlineHistory::GetHistory(), m_color, m_editor_name, m_editor_status, m_error_stream_sp, m_history_sp, m_input_connection, m_input_file, and m_output_stream_sp.
Referenced by DisplayCompletions(), and InstanceFor().
Editline::~Editline | ( | ) |
Definition at line 1520 of file Editline.cpp.
References m_editline, and m_history_sp.
|
private |
Definition at line 1240 of file Editline.cpp.
References el_wset, and m_editline.
Referenced by ConfigureEditor().
|
private |
Apply autosuggestion part in gray as editline.
Definition at line 1185 of file Editline.cpp.
References m_editline, and m_suggestion_callback.
Referenced by ConfigureEditor().
|
private |
Definition at line 1548 of file Editline.cpp.
References el_wline, GetPromptWidth(), LineInfoW, m_current_line_rows, m_editline, m_terminal_height, m_terminal_size_has_changed, and m_terminal_width.
Referenced by ConfigureEditor(), and GetCharacter().
|
private |
Line break command used when meta+return is pressed in multi-line mode.
Definition at line 636 of file Editline.cpp.
References lldb_private::StringList::AppendString(), lldb_private::line_editor::BlockEnd, DisplayInput(), lldb_private::line_editor::EditingCursor, lldb_private::line_editor::EditingPrompt, EditLineConstString, el_wline, FixIndentation(), GetIndentation(), GetInputAsStringList(), IsInputPending(), IsOnlySpaces(), LineInfoW, m_current_line_index, m_editline, m_fix_indentation_callback, m_input_file, m_input_lines, m_revert_cursor_index, MoveCursor(), and SetCurrentLine().
Referenced by ConfigureEditor(), and EndOrAddLineCommand().
|
private |
Buffer end command used when Esc > is typed in multi-line emacs mode.
Definition at line 942 of file Editline.cpp.
References lldb_private::line_editor::BlockEnd, lldb_private::line_editor::EditingCursor, lldb_private::line_editor::EditingPrompt, m_input_lines, MoveCursor(), SaveEditedLine(), and SetCurrentLine().
Referenced by ConfigureEditor().
|
private |
Buffer start command used when Esc < is typed in multi-line emacs mode.
Definition at line 934 of file Editline.cpp.
References lldb_private::line_editor::BlockStart, lldb_private::line_editor::EditingCursor, m_revert_cursor_index, MoveCursor(), SaveEditedLine(), and SetCurrentLine().
Referenced by ConfigureEditor().
bool Editline::Cancel | ( | ) |
Cancel this edit and obliterate all trace of it.
Definition at line 1597 of file Editline.cpp.
References ANSI_CLEAR_BELOW, lldb_private::line_editor::BlockStart, lldb_private::line_editor::Editing, lldb_private::line_editor::EditingCursor, lldb_private::StreamFile::GetFile(), lldb_private::File::GetStream(), lldb_private::line_editor::Interrupted, m_editor_status, m_input_connection, m_output_stream_sp, and MoveCursor().
|
private |
Definition at line 1713 of file Editline.cpp.
References m_input_connection.
Referenced by GetCharacter().
|
private |
Ensures that the current EditLine instance is properly configured for single or multi-line editing.
Definition at line 1255 of file Editline.cpp.
References AddFunctionToEditLine(), ApplyAutosuggestCommand(), ApplyTerminalSizeChange(), BreakLineCommand(), BufferEndCommand(), BufferStartCommand(), DeleteNextCharCommand(), DeletePreviousCharCommand(), EditLineConstString, el_wset, EndOrAddLineCommand(), ESCAPE, FixIndentationCommand(), GetCharacter(), lldb_private::StreamFile::GetFile(), lldb_private::File::GetStream(), InstanceFor(), IsEmacs(), m_editline, m_editor_name, m_fix_indentation_callback, m_fix_indentation_callback_chars, m_history_sp, m_input_file, m_multiline_enabled, m_output_stream_sp, m_suggestion_callback, NextHistoryCommand(), NextLineCommand(), PreviousHistoryCommand(), PreviousLineCommand(), Prompt(), RevertLineCommand(), SetEditLinePromptCallback(), SetGetCharacterFunction(), TabCommand(), and TypedCharacter().
Referenced by GetLine(), and GetLines().
|
private |
Counts the number of rows a given line of content will end up occupying, taking into account both the preceding prompt and a single trailing space occupied by a cursor when at the end of the line.
Definition at line 442 of file Editline.cpp.
References lldb_private::ansi::ColumnWidth(), m_terminal_width, and PromptForIndex().
Referenced by DeletePreviousCharCommand(), GetLineIndexForLocation(), and PreviousLineCommand().
|
private |
Delete command used when delete is pressed in multi-line mode.
Definition at line 725 of file Editline.cpp.
References lldb_private::line_editor::BlockEnd, DisplayInput(), lldb_private::line_editor::EditingCursor, lldb_private::line_editor::EditingPrompt, el_winsertstr, el_wline, lldb_private::line_editor::EndOfInput, lldb_private::StreamFile::GetFile(), lldb_private::File::GetStream(), LineInfoW, m_current_line_index, m_editline, m_editor_status, m_input_lines, m_output_stream_sp, MoveCursor(), and SaveEditedLine().
Referenced by ConfigureEditor().
|
private |
Delete command used when backspace is pressed in multi-line mode.
Definition at line 765 of file Editline.cpp.
References ANSI_SET_COLUMN_N, ANSI_UP_N_ROWS, lldb_private::line_editor::BlockEnd, CountRowsForLine(), DisplayInput(), lldb_private::line_editor::EditingPrompt, el_winsertstr, el_wline, lldb_private::StreamFile::GetFile(), lldb_private::File::GetStream(), LineInfoW, m_current_line_index, m_editline, m_input_lines, m_output_stream_sp, MoveCursor(), SaveEditedLine(), and SetCurrentLine().
Referenced by ConfigureEditor().
|
static |
Account for the current line, the line showing "Available completions" before and the line saying "More" after.
Definition at line 1053 of file Editline.cpp.
References ANSI_CLEAR_BELOW, lldb_private::line_editor::Editing, Editline(), el_wgetc, lldb_private::StreamFile::GetFile(), lldb_private::File::GetStream(), GetTerminalHeight(), GetTerminalWidth(), lldb_private::line_editor::Interrupted, m_editline, m_editor_status, m_output_stream_sp, and PrintCompletion().
Referenced by TabCommand().
|
private |
Clear from cursor position to bottom of screen and print input lines including prompts, optionally starting from a specific line.
Lines are drawn with an extra space at the end to reserve room for the rightmost cursor position.
Definition at line 425 of file Editline.cpp.
References ANSI_CLEAR_BELOW, ANSI_SET_COLUMN_N, EditLineStringFormatSpec, lldb_private::StreamFile::GetFile(), lldb_private::File::GetStream(), m_input_lines, m_output_stream_sp, m_prompt_ansi_prefix, m_prompt_ansi_suffix, and PromptForIndex().
Referenced by BreakLineCommand(), DeleteNextCharCommand(), DeletePreviousCharCommand(), FixIndentationCommand(), GetCharacter(), GetLines(), PrintAsync(), RecallHistory(), and TabCommand().
|
private |
Command used when return is pressed in multi-line mode.
Definition at line 684 of file Editline.cpp.
References lldb_private::line_editor::BlockEnd, BreakLineCommand(), lldb_private::line_editor::Complete, lldb_private::line_editor::EditingCursor, el_wline, lldb_private::StreamFile::GetFile(), GetInputAsStringList(), lldb_private::File::GetStream(), IsInputPending(), LineInfoW, m_current_line_index, m_editline, m_editor_status, m_input_file, m_input_lines, m_is_input_complete_callback, m_output_stream_sp, MoveCursor(), and SaveEditedLine().
Referenced by ConfigureEditor().
|
private |
Respond to normal character insertion by fixing line indentation.
Definition at line 874 of file Editline.cpp.
References lldb_private::line_editor::BlockEnd, DisplayInput(), lldb_private::line_editor::EditingCursor, lldb_private::line_editor::EditingPrompt, el_winsertstr, el_wline, GetInputAsStringList(), lldb_private::StringList::GetStringAtIndex(), LineInfoW, m_current_line_index, m_editline, m_fix_indentation_callback, m_input_lines, m_revert_cursor_index, MoveCursor(), SaveEditedLine(), and SetCurrentLine().
Referenced by ConfigureEditor().
|
private |
Character reading implementation for EditLine that supports our multi-line editing trickery.
Definition at line 544 of file Editline.cpp.
References ApplyTerminalSizeChange(), lldb_private::line_editor::BlockEnd, CompleteCharacter(), DisplayInput(), lldb::eConnectionStatusEndOfFile, lldb::eConnectionStatusError, lldb::eConnectionStatusInterrupted, lldb::eConnectionStatusLostConnection, lldb::eConnectionStatusNoConnection, lldb::eConnectionStatusSuccess, lldb::eConnectionStatusTimedOut, lldb_private::line_editor::EditingCursor, lldb_private::line_editor::EditingPrompt, el_wline, lldb_private::line_editor::EndOfInput, GetPromptWidth(), lldb_private::line_editor::Interrupted, LineInfoW, lldbassert, m_current_line_index, m_current_line_rows, m_editline, m_editor_status, m_input_connection, m_locked_output, m_multiline_enabled, m_needs_prompt_repaint, m_output_stream_sp, m_prompt_ansi_prefix, m_prompt_ansi_suffix, m_redraw_callback, m_terminal_size_has_changed, m_terminal_width, MoveCursor(), Prompt(), and SaveEditedLine().
Referenced by ConfigureEditor().
uint32_t Editline::GetCurrentLine | ( | ) |
Returns the index of the line currently being edited.
Definition at line 1584 of file Editline.cpp.
References m_current_line_index.
StringList Editline::GetInputAsStringList | ( | int | line_count = UINT32_MAX | ) |
Convert the current input lines into a UTF8 StringList.
Definition at line 455 of file Editline.cpp.
References lldb_private::StringList::AppendString(), and m_input_lines.
Referenced by BreakLineCommand(), EndOrAddLineCommand(), FixIndentationCommand(), GetLines(), and NextLineCommand().
Prompts for and reads a single line of user input.
Definition at line 1609 of file Editline.cpp.
References lldb_private::line_editor::Complete, ConfigureEditor(), lldb_private::line_editor::Editing, EditLineConstString, el_wgets, lldb_private::line_editor::EndOfInput, lldb_private::line_editor::Interrupted, lldbassert, m_editline, m_editor_status, m_history_sp, m_in_history, m_input_lines, m_locked_output, m_output_stream_sp, m_revert_cursor_index, SetCurrentLine(), and SplitLines().
|
private |
Helper method used by MoveCursor to determine relative line position.
Definition at line 373 of file Editline.cpp.
References lldb_private::line_editor::BlockEnd, CountRowsForLine(), lldb_private::line_editor::EditingCursor, lldb_private::line_editor::EditingPrompt, m_current_line_index, and m_input_lines.
Referenced by MoveCursor().
bool Editline::GetLines | ( | int | first_line_number, |
StringList & | lines, | ||
bool & | interrupted ) |
Prompts for and reads a multi-line batch of user input.
Definition at line 1650 of file Editline.cpp.
References lldb_private::line_editor::BlockEnd, lldb_private::line_editor::BlockStart, CombineLines(), ConfigureEditor(), DisplayInput(), lldb_private::line_editor::Editing, EditLineConstString, el_wgets, el_wpush, lldb_private::line_editor::EndOfInput, GetInputAsStringList(), lldb_private::line_editor::Interrupted, m_current_line_rows, m_editline, m_editor_status, m_history_sp, m_in_history, m_input_lines, m_locked_output, m_output_stream_sp, m_revert_cursor_index, MoveCursor(), SetBaseLineNumber(), and SetCurrentLine().
const char * Editline::GetPrompt | ( | ) |
Returns the prompt established by SetPrompt.
Definition at line 1582 of file Editline.cpp.
References m_set_prompt.
|
private |
Determines the width of the prompt in characters.
The width is guaranteed to be the same for all lines of the current multi-line session.
Definition at line 353 of file Editline.cpp.
References lldb_private::ansi::ColumnWidth(), and PromptForIndex().
Referenced by ApplyTerminalSizeChange(), GetCharacter(), MoveCursor(), NextLineCommand(), and TypedCharacter().
|
inline |
Definition at line 268 of file Editline.h.
References m_terminal_height.
Referenced by DisplayCompletions().
|
inline |
Definition at line 266 of file Editline.h.
References m_terminal_width.
Referenced by DisplayCompletions().
|
static |
Uses the user data storage of EditLine to retrieve an associated instance of Editline.
Definition at line 1502 of file Editline.cpp.
References Editline().
Referenced by ConfigureEditor().
bool Editline::Interrupt | ( | ) |
Interrupt the current edit as if ^C was pressed.
Definition at line 1586 of file Editline.cpp.
References lldb_private::line_editor::Editing, lldb_private::StreamFile::GetFile(), lldb_private::File::GetStream(), lldb_private::line_editor::Interrupted, m_editor_status, m_input_connection, and m_output_stream_sp.
|
private |
Returns true if the underlying EditLine session's keybindings are Emacs-based, or false if they are VI-based.
Definition at line 357 of file Editline.cpp.
References m_editline.
Referenced by ConfigureEditor().
|
private |
Returns true if the current EditLine buffer contains nothing but spaces, or is empty.
Definition at line 363 of file Editline.cpp.
References el_wline, LineInfoW, and m_editline.
Referenced by BreakLineCommand(), NextLineCommand(), and PreviousLineCommand().
|
private |
Move the cursor from one well-established location to another using relative line positioning and absolute column positioning.
Definition at line 394 of file Editline.cpp.
References ANSI_DOWN_N_ROWS, ANSI_SET_COLUMN_N, ANSI_UP_N_ROWS, lldb_private::line_editor::BlockEnd, lldb_private::line_editor::EditingCursor, el_wline, lldb_private::StreamFile::GetFile(), GetLineIndexForLocation(), GetPromptWidth(), lldb_private::File::GetStream(), LineInfoW, m_editline, m_input_lines, m_output_stream_sp, and m_terminal_width.
Referenced by BreakLineCommand(), BufferEndCommand(), BufferStartCommand(), Cancel(), DeleteNextCharCommand(), DeletePreviousCharCommand(), EndOrAddLineCommand(), FixIndentationCommand(), GetCharacter(), GetLines(), PreviousLineCommand(), PrintAsync(), RecallHistory(), and TabCommand().
|
private |
History navigation command used when Alt + down arrow is pressed in multi-line mode.
Definition at line 868 of file Editline.cpp.
References lldb_private::line_editor::Newer, RecallHistory(), and SaveEditedLine().
Referenced by ConfigureEditor().
|
private |
Line navigation command used when ^N or down arrow are pressed in multi-line mode.
Definition at line 824 of file Editline.cpp.
References lldb_private::StringList::AppendString(), el_wline, lldb_private::StreamFile::GetFile(), GetInputAsStringList(), GetPromptWidth(), lldb_private::File::GetStream(), IsOnlySpaces(), LineInfoW, m_current_line_index, m_current_line_rows, m_editline, m_fix_indentation_callback, m_input_lines, m_output_stream_sp, m_terminal_width, lldb_private::line_editor::Newer, RecallHistory(), SaveEditedLine(), and SetCurrentLine().
Referenced by ConfigureEditor().
|
private |
History navigation command used when Alt + up arrow is pressed in multi-line mode.
Definition at line 862 of file Editline.cpp.
References lldb_private::line_editor::Older, RecallHistory(), and SaveEditedLine().
Referenced by ConfigureEditor().
|
private |
Line navigation command used when ^P or up arrow are pressed in multi-line mode.
Definition at line 800 of file Editline.cpp.
References ANSI_CLEAR_BELOW, ANSI_SET_COLUMN_N, ANSI_UP_N_ROWS, CountRowsForLine(), lldb_private::line_editor::EditingCursor, lldb_private::line_editor::EditingPrompt, lldb_private::StreamFile::GetFile(), lldb_private::File::GetStream(), IsOnlySpaces(), m_current_line_index, m_input_lines, m_output_stream_sp, MoveCursor(), lldb_private::line_editor::Older, RecallHistory(), SaveEditedLine(), and SetCurrentLine().
Referenced by ConfigureEditor().
void Editline::PrintAsync | ( | lldb::LockableStreamFileSP | stream_sp, |
const char * | s, | ||
size_t | len ) |
Definition at line 1691 of file Editline.cpp.
References ANSI_CLEAR_BELOW, lldb_private::line_editor::BlockEnd, lldb_private::line_editor::BlockStart, DisplayInput(), lldb_private::line_editor::Editing, lldb_private::line_editor::EditingCursor, lldb_private::StreamFile::GetFile(), lldb_private::File::GetStream(), m_editor_status, m_output_stream_sp, MoveCursor(), SaveEditedLine(), and lldb_private::Stream::Write().
|
private |
Prompt implementation for EditLine.
Definition at line 630 of file Editline.cpp.
References m_color, m_current_prompt, and m_needs_prompt_repaint.
Referenced by ConfigureEditor(), and GetCharacter().
|
private |
Returns the complete prompt by combining the prompt or continuation prompt with line numbers as appropriate.
The line index is a zero-based index into the current multi-line session.
Definition at line 318 of file Editline.cpp.
References lldb_private::ansi::ColumnWidth(), lldb_private::StreamString::GetString(), m_base_line_number, m_line_number_digits, m_multiline_enabled, m_set_continuation_prompt, m_set_prompt, and lldb_private::Stream::Printf().
Referenced by CountRowsForLine(), DisplayInput(), GetPromptWidth(), and SetCurrentLine().
|
private |
Replaces the current multi-line session with the next entry from history.
Definition at line 472 of file Editline.cpp.
References lldb_private::line_editor::BlockEnd, lldb_private::line_editor::BlockStart, DisplayInput(), lldb_private::line_editor::EditingCursor, lldb_private::line_editor::EditingPrompt, GetOperation(), history_w, HistoryW, m_current_line_index, m_history_sp, m_in_history, m_input_lines, m_live_history_lines, MoveCursor(), lldb_private::line_editor::Newer, lldb_private::line_editor::Newest, lldb_private::line_editor::Older, SaveEditedLine(), SetCurrentLine(), and SplitLines().
Referenced by NextHistoryCommand(), NextLineCommand(), PreviousHistoryCommand(), and PreviousLineCommand().
void Editline::Refresh | ( | ) |
Definition at line 1706 of file Editline.cpp.
References m_editline, and m_output_stream_sp.
|
private |
Revert line command used when moving between lines.
Definition at line 921 of file Editline.cpp.
References el_winsertstr, el_wline, LineInfoW, m_current_line_index, m_editline, m_input_lines, and m_revert_cursor_index.
Referenced by ConfigureEditor().
|
private |
Save the line currently being edited.
Definition at line 449 of file Editline.cpp.
References el_wline, LineInfoW, m_current_line_index, m_editline, and m_input_lines.
Referenced by BufferEndCommand(), BufferStartCommand(), DeleteNextCharCommand(), DeletePreviousCharCommand(), EndOrAddLineCommand(), FixIndentationCommand(), GetCharacter(), NextHistoryCommand(), NextLineCommand(), PreviousHistoryCommand(), PreviousLineCommand(), PrintAsync(), and RecallHistory().
|
inline |
Register a callback for the tab key.
Definition at line 208 of file Editline.h.
References m_completion_callback.
|
private |
Sets the lowest line number for multi-line editing sessions.
A value of zero suppresses line number printing in the prompt.
Definition at line 312 of file Editline.cpp.
References m_base_line_number, and m_line_number_digits.
Referenced by GetLines().
void Editline::SetContinuationPrompt | ( | const char * | continuation_prompt | ) |
Sets an alternate string to be used as a prompt for the second line and beyond in multi-line editing scenarios.
Definition at line 1541 of file Editline.cpp.
References m_set_continuation_prompt.
|
private |
Sets the current line index between line edits to allow free movement between lines.
Updates the prompt to match.
Definition at line 348 of file Editline.cpp.
References m_current_line_index, m_current_prompt, and PromptForIndex().
Referenced by BreakLineCommand(), BufferEndCommand(), BufferStartCommand(), DeletePreviousCharCommand(), FixIndentationCommand(), GetLine(), GetLines(), NextLineCommand(), PreviousLineCommand(), and RecallHistory().
|
private |
Definition at line 1246 of file Editline.cpp.
References m_editline.
Referenced by ConfigureEditor().
|
inline |
Register a callback for determining the appropriate indentation for a line when creating a newline.
An optional set of insertable characters can also trigger the callback.
Definition at line 220 of file Editline.h.
References m_fix_indentation_callback, and m_fix_indentation_callback_chars.
|
private |
Definition at line 1251 of file Editline.cpp.
References el_wset, and m_editline.
Referenced by ConfigureEditor().
|
inline |
Register a callback for testing whether multi-line input is complete.
Definition at line 213 of file Editline.h.
References m_is_input_complete_callback.
void Editline::SetPrompt | ( | const char * | prompt | ) |
Sets a string to be used as a prompt, or combined with a line number to form a prompt.
Definition at line 1537 of file Editline.cpp.
References m_set_prompt.
|
inline |
Definition at line 226 of file Editline.h.
References m_color, and m_prompt_ansi_prefix.
|
inline |
Definition at line 233 of file Editline.h.
References m_color, and m_prompt_ansi_suffix.
|
inline |
Register a callback for redrawing the statusline.
Definition at line 203 of file Editline.h.
References m_redraw_callback.
|
inline |
Definition at line 240 of file Editline.h.
References m_color, and m_suggestion_ansi_prefix.
|
inline |
Definition at line 247 of file Editline.h.
References m_color, and m_suggestion_ansi_suffix.
|
inline |
Register a callback for autosuggestion.
Definition at line 198 of file Editline.h.
References m_suggestion_callback.
|
private |
Context-sensitive tab insertion or code completion command used when the tab key is typed.
Definition at line 1111 of file Editline.cpp.
References lldb_private::line_editor::BlockEnd, DisplayCompletions(), DisplayInput(), lldb_private::line_editor::EditingCursor, lldb_private::Args::empty(), lldb_private::CompletionResult::Completion::GetCompletion(), lldb_private::CompletionRequest::GetCursorArgumentPrefix(), lldb_private::CompletionRequest::GetCursorIndex(), lldb_private::CompletionResult::GetMatches(), lldb_private::CompletionResult::Completion::GetMode(), lldb_private::CompletionRequest::GetParsedArg(), lldb_private::CompletionRequest::GetParsedLine(), lldb_private::Args::ArgEntry::GetQuoteChar(), lldb_private::CompletionResult::GetResults(), lldb_private::Args::ArgEntry::IsQuoted(), lldb_private::StringList::LongestCommonPrefix(), m_completion_callback, m_editline, MoveCursor(), lldb_private::Normal, lldb_private::Partial, lldb_private::RewriteLine, and lldb_private::Args::size().
Referenced by ConfigureEditor().
void Editline::TerminalSizeChanged | ( | ) |
Call when the terminal size changes.
Definition at line 1546 of file Editline.cpp.
References m_terminal_size_has_changed.
|
private |
Command used when a character is typed.
Definition at line 1200 of file Editline.cpp.
References ANSI_SET_COLUMN_N, lldb_private::StreamFile::GetFile(), GetPromptWidth(), lldb_private::File::GetStream(), m_editline, m_output_stream_sp, m_previous_autosuggestion_size, m_suggestion_ansi_prefix, m_suggestion_ansi_suffix, m_suggestion_callback, and m_terminal_width.
Referenced by ConfigureEditor().
void Editline::UseColor | ( | bool | use_color | ) |
Sets if editline should use color.
Definition at line 1109 of file Editline.cpp.
References m_color.
|
private |
Definition at line 406 of file Editline.h.
Referenced by PromptForIndex(), and SetBaseLineNumber().
|
private |
Definition at line 434 of file Editline.h.
Referenced by Editline(), Prompt(), SetPromptAnsiPrefix(), SetPromptAnsiSuffix(), SetSuggestionAnsiPrefix(), SetSuggestionAnsiSuffix(), and UseColor().
|
private |
Definition at line 430 of file Editline.h.
Referenced by SetAutoCompleteCallback(), and TabCommand().
|
private |
Definition at line 407 of file Editline.h.
Referenced by BreakLineCommand(), DeleteNextCharCommand(), DeletePreviousCharCommand(), EndOrAddLineCommand(), FixIndentationCommand(), GetCharacter(), GetCurrentLine(), GetLineIndexForLocation(), NextLineCommand(), PreviousLineCommand(), RecallHistory(), RevertLineCommand(), SaveEditedLine(), and SetCurrentLine().
|
private |
Definition at line 408 of file Editline.h.
Referenced by ApplyTerminalSizeChange(), GetCharacter(), GetLines(), and NextLineCommand().
|
private |
Definition at line 413 of file Editline.h.
Referenced by Prompt(), and SetCurrentLine().
|
private |
Definition at line 397 of file Editline.h.
Referenced by AddFunctionToEditLine(), ApplyAutosuggestCommand(), ApplyTerminalSizeChange(), BreakLineCommand(), ConfigureEditor(), DeleteNextCharCommand(), DeletePreviousCharCommand(), DisplayCompletions(), EndOrAddLineCommand(), FixIndentationCommand(), GetCharacter(), GetLine(), GetLines(), IsEmacs(), IsOnlySpaces(), MoveCursor(), NextLineCommand(), Refresh(), RevertLineCommand(), SaveEditedLine(), SetEditLinePromptCallback(), SetGetCharacterFunction(), TabCommand(), TypedCharacter(), and ~Editline().
|
private |
Definition at line 416 of file Editline.h.
Referenced by ConfigureEditor(), and Editline().
|
private |
Definition at line 403 of file Editline.h.
Referenced by Cancel(), DeleteNextCharCommand(), DisplayCompletions(), Editline(), EndOrAddLineCommand(), GetCharacter(), GetLine(), GetLines(), Interrupt(), and PrintAsync().
|
private |
Definition at line 419 of file Editline.h.
Referenced by Editline().
|
private |
Definition at line 427 of file Editline.h.
Referenced by BreakLineCommand(), ConfigureEditor(), FixIndentationCommand(), NextLineCommand(), and SetFixIndentationCallback().
|
private |
Definition at line 428 of file Editline.h.
Referenced by ConfigureEditor(), and SetFixIndentationCallback().
|
private |
Definition at line 398 of file Editline.h.
Referenced by ConfigureEditor(), Editline(), GetLine(), GetLines(), RecallHistory(), and ~Editline().
|
private |
Definition at line 399 of file Editline.h.
Referenced by GetLine(), GetLines(), and RecallHistory().
|
private |
Definition at line 423 of file Editline.h.
Referenced by Cancel(), CompleteCharacter(), Editline(), GetCharacter(), and Interrupt().
|
private |
Definition at line 417 of file Editline.h.
Referenced by BreakLineCommand(), ConfigureEditor(), Editline(), and EndOrAddLineCommand().
|
private |
Definition at line 402 of file Editline.h.
Referenced by BreakLineCommand(), BufferEndCommand(), DeleteNextCharCommand(), DeletePreviousCharCommand(), DisplayInput(), EndOrAddLineCommand(), FixIndentationCommand(), GetInputAsStringList(), GetLine(), GetLineIndexForLocation(), GetLines(), MoveCursor(), NextLineCommand(), PreviousLineCommand(), RecallHistory(), RevertLineCommand(), and SaveEditedLine().
|
private |
Definition at line 425 of file Editline.h.
Referenced by EndOrAddLineCommand(), and SetIsInputCompleteCallback().
|
private |
Definition at line 410 of file Editline.h.
Referenced by PromptForIndex(), and SetBaseLineNumber().
|
private |
Definition at line 400 of file Editline.h.
Referenced by RecallHistory().
|
private |
Definition at line 421 of file Editline.h.
Referenced by GetCharacter(), GetLine(), and GetLines().
|
private |
Definition at line 401 of file Editline.h.
Referenced by ConfigureEditor(), GetCharacter(), and PromptForIndex().
|
private |
Definition at line 414 of file Editline.h.
Referenced by GetCharacter(), and Prompt().
|
private |
Definition at line 418 of file Editline.h.
Referenced by Cancel(), ConfigureEditor(), DeleteNextCharCommand(), DeletePreviousCharCommand(), DisplayCompletions(), DisplayInput(), Editline(), EndOrAddLineCommand(), GetCharacter(), GetLine(), GetLines(), Interrupt(), MoveCursor(), NextLineCommand(), PreviousLineCommand(), PrintAsync(), Refresh(), and TypedCharacter().
|
private |
Definition at line 440 of file Editline.h.
Referenced by TypedCharacter().
|
private |
Definition at line 435 of file Editline.h.
Referenced by DisplayInput(), GetCharacter(), and SetPromptAnsiPrefix().
|
private |
Definition at line 436 of file Editline.h.
Referenced by DisplayInput(), GetCharacter(), and SetPromptAnsiSuffix().
|
private |
Definition at line 432 of file Editline.h.
Referenced by GetCharacter(), and SetRedrawCallback().
|
private |
Definition at line 409 of file Editline.h.
Referenced by BreakLineCommand(), BufferStartCommand(), FixIndentationCommand(), GetLine(), GetLines(), and RevertLineCommand().
|
private |
Definition at line 412 of file Editline.h.
Referenced by PromptForIndex(), and SetContinuationPrompt().
|
private |
Definition at line 411 of file Editline.h.
Referenced by GetPrompt(), PromptForIndex(), and SetPrompt().
|
private |
Definition at line 437 of file Editline.h.
Referenced by SetSuggestionAnsiPrefix(), and TypedCharacter().
|
private |
Definition at line 438 of file Editline.h.
Referenced by SetSuggestionAnsiSuffix(), and TypedCharacter().
|
private |
Definition at line 431 of file Editline.h.
Referenced by ApplyAutosuggestCommand(), ConfigureEditor(), SetSuggestionCallback(), and TypedCharacter().
|
private |
Definition at line 405 of file Editline.h.
Referenced by ApplyTerminalSizeChange(), and GetTerminalHeight().
|
private |
Definition at line 415 of file Editline.h.
Referenced by ApplyTerminalSizeChange(), GetCharacter(), and TerminalSizeChanged().
|
private |
Definition at line 404 of file Editline.h.
Referenced by ApplyTerminalSizeChange(), CountRowsForLine(), GetCharacter(), GetTerminalWidth(), MoveCursor(), NextLineCommand(), and TypedCharacter().