[Lldb-commits] [lldb] r156510 - in /lldb/trunk/tools/driver: Driver.cpp IOChannel.cpp IOChannel.h
Johnny Chen
johnny.chen at apple.com
Wed May 9 14:03:07 PDT 2012
Author: johnny
Date: Wed May 9 16:03:07 2012
New Revision: 156510
URL: http://llvm.org/viewvc/llvm-project?rev=156510&view=rev
Log:
Make ctrl-c terminate the current input line and start an empty line, instead of the previous content.
rdar://problem/11412821
Modified:
lldb/trunk/tools/driver/Driver.cpp
lldb/trunk/tools/driver/IOChannel.cpp
lldb/trunk/tools/driver/IOChannel.h
Modified: lldb/trunk/tools/driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=156510&r1=156509&r2=156510&view=diff
==============================================================================
--- lldb/trunk/tools/driver/Driver.cpp (original)
+++ lldb/trunk/tools/driver/Driver.cpp Wed May 9 16:03:07 2012
@@ -1081,6 +1081,8 @@
if (driver->m_io_channel_ap.get() != NULL)
{
driver->m_io_channel_ap->OutWrite ("^C\n", 3, NO_ASYNC);
+ // I wish I could erase the entire input line, but there's no public API for that.
+ driver->m_io_channel_ap->EraseCharsBeforeCursor();
driver->m_io_channel_ap->RefreshPrompt();
}
break;
Modified: lldb/trunk/tools/driver/IOChannel.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/IOChannel.cpp?rev=156510&r1=156509&r2=156510&view=diff
==============================================================================
--- lldb/trunk/tools/driver/IOChannel.cpp (original)
+++ lldb/trunk/tools/driver/IOChannel.cpp Wed May 9 16:03:07 2012
@@ -50,6 +50,13 @@
return pos->second.c_str();
}
+void
+IOChannel::EraseCharsBeforeCursor ()
+{
+ const LineInfo *line_info = el_line(m_edit_line);
+ el_deletestr(m_edit_line, line_info->cursor - line_info->buffer);
+}
+
unsigned char
IOChannel::ElCompletionFn (EditLine *e, int ch)
{
Modified: lldb/trunk/tools/driver/IOChannel.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/IOChannel.h?rev=156510&r1=156509&r2=156510&view=diff
==============================================================================
--- lldb/trunk/tools/driver/IOChannel.h (original)
+++ lldb/trunk/tools/driver/IOChannel.h Wed May 9 16:03:07 2012
@@ -96,6 +96,9 @@
const char *
GetPrompt ();
+ void
+ EraseCharsBeforeCursor ();
+
static unsigned char
ElCompletionFn (EditLine *e, int ch);
More information about the lldb-commits
mailing list