diff options
author | Greg Clayton <gclayton@apple.com> | 2014-01-30 20:59:18 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2014-01-30 20:59:18 +0000 |
commit | 10c0ef7b8aaae3b7a6210b181544f2f6979d149c (patch) | |
tree | cd0539f7033049a592839dd3418bb7e9afea1b2a /lldb/source/Host | |
parent | 196666cf5fccba4d90241c921e9e581deaf5aa55 (diff) | |
download | bcm5719-llvm-10c0ef7b8aaae3b7a6210b181544f2f6979d149c.tar.gz bcm5719-llvm-10c0ef7b8aaae3b7a6210b181544f2f6979d149c.zip |
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>
llvm-svn: 200489
Diffstat (limited to 'lldb/source/Host')
-rw-r--r-- | lldb/source/Host/common/Editline.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lldb/source/Host/common/Editline.cpp b/lldb/source/Host/common/Editline.cpp index 53fa64103ab..7e6a2f55e37 100644 --- a/lldb/source/Host/common/Editline.cpp +++ b/lldb/source/Host/common/Editline.cpp @@ -630,7 +630,21 @@ Editline::GetCharFromInputFileCallback (EditLine *e, char *c) 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; } |