Skip to content

Commit

Permalink
Complete rewrite of interactive editing support for single- and multi…
Browse files Browse the repository at this point in the history
…-line input.

Improvements include:
* Use of libedit's wide character support, which is imperfect but a distinct improvement over ASCII-only
* Fallback for ASCII editing path
* Support for a "faint" prompt clearly distinguished from input
* Breaking lines and insert new lines in the middle of a batch by simply pressing return
* Joining lines with forward and backward character deletion
* Detection of paste to suppress automatic formatting and statement completion tests
* Correctly reformatting when lines grow or shrink to occupy different numbers of rows
* Saving multi-line history, and correctly preserving the "tip" of history during editing
* Displaying visible ^C and ^D indications when interrupting input or sending EOF
* Fledgling VI support for multi-line editing
* General correctness and reliability improvements

llvm-svn: 222163
  • Loading branch information
Kate Stone committed Nov 17, 2014
1 parent 278ddec commit e30f11d
Show file tree
Hide file tree
Showing 10 changed files with 1,869 additions and 916 deletions.
305 changes: 242 additions & 63 deletions lldb/include/lldb/Core/IOHandler.h

Large diffs are not rendered by default.

476 changes: 316 additions & 160 deletions lldb/include/lldb/Host/Editline.h

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions lldb/include/lldb/Interpreter/CommandInterpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,9 @@ class CommandInterpreter :
return m_quit_requested;
}

lldb::IOHandlerSP
GetIOHandler(bool force_create = false, CommandInterpreterRunOptions *options = NULL);

bool
GetStoppedForCrash () const
{
Expand Down
4 changes: 4 additions & 0 deletions lldb/source/Commands/CommandObjectCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1030,11 +1030,15 @@ class CommandObjectCommandsAddRegex :
if (argc == 1)
{
Debugger &debugger = m_interpreter.GetDebugger();
bool color_prompt = debugger.GetUseColor();
const bool multiple_lines = true; // Get multiple lines
IOHandlerSP io_handler_sp (new IOHandlerEditline (debugger,
IOHandler::Type::Other,
"lldb-regex", // Name of input reader for history
"\033[K> ", // Prompt and clear line
NULL, // Continuation prompt
multiple_lines,
color_prompt,
0, // Don't show line numbers
*this));

Expand Down
4 changes: 4 additions & 0 deletions lldb/source/Commands/CommandObjectExpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,11 +425,15 @@ CommandObjectExpression::GetMultilineExpression ()
m_expr_line_count = 0;

Debugger &debugger = GetCommandInterpreter().GetDebugger();
bool color_prompt = debugger.GetUseColor();
const bool multiple_lines = true; // Get multiple lines
IOHandlerSP io_handler_sp (new IOHandlerEditline (debugger,
IOHandler::Type::Expression,
"lldb-expr", // Name of input reader for history
NULL, // No prompt
NULL, // Continuation prompt
multiple_lines,
color_prompt,
1, // Show line numbers starting at 1
*this));

Expand Down
Loading

0 comments on commit e30f11d

Please sign in to comment.