Author: gclayton
Date: Thu Jan 30 14:59:18 2014
New Revision: 200489
URL: http://llvm.org/viewvc/llvm-project?rev=200489&view=rev
Log:
Pressing ^D in a non-empty input terminates LLDB. This was due to the fact that
we stack more than one editline instance on top of each other and we still
expect CTRL+D to exit the editline instance, but it should only do so when the
line is empty. Otherwise it should (and does) delete the character at the
cursor.
<rdar://problem/15944703>
Modified:
lldb/trunk/source/Host/common/Editline.cpp
Modified: lldb/trunk/source/Host/common/Editline.cpp
URL:
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Editline.cpp?rev=200489&r1=200488&r2=200489&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Editline.cpp (original)
+++ lldb/trunk/source/Host/common/Editline.cpp Thu Jan 30 14:59:18 2014
@@ -630,7 +630,21 @@ Editline::GetCharFromInputFileCallback (
if (editline && editline->m_got_eof == false)
{
char ch = ::fgetc(editline->GetInputFile());
- if (ch == '\x04' || ch == EOF)
+ if (ch == '\x04')
+ {
+ // Only turn a CTRL+D into a EOF if we receive the
+ // CTRL+D an empty line, otherwise it will forward
+ // delete the character at the cursor
+ const LineInfo *line_info = ::el_line(e);
+ if (line_info != NULL &&
+ line_info->buffer == line_info->cursor &&
+ line_info->cursor == line_info->lastchar)
+ {
+ ch = EOF;
+ }
+ }
+
+ if (ch == EOF)
{
editline->m_got_eof = true;
}
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits