From 6d10c17a31122cda3fd04398eb95be441f6d8f0c Mon Sep 17 00:00:00 2001 From: Jim Ingham Date: Fri, 1 Jun 2012 01:03:40 +0000 Subject: [PATCH] Add an API to determine whether there are any characters on the current input line. llvm-svn: 157789 --- lldb/tools/driver/IOChannel.cpp | 11 +++++++++++ lldb/tools/driver/IOChannel.h | 3 +++ 2 files changed, 14 insertions(+) diff --git a/lldb/tools/driver/IOChannel.cpp b/lldb/tools/driver/IOChannel.cpp index 25274581efed..0ed6fd326794 100644 --- a/lldb/tools/driver/IOChannel.cpp +++ b/lldb/tools/driver/IOChannel.cpp @@ -50,6 +50,17 @@ IOChannel::GetPrompt () return pos->second.c_str(); } +bool +IOChannel::EditLineHasCharacters () +{ + const LineInfo *line_info = el_line(m_edit_line); + if (line_info) + return line_info->cursor != line_info->buffer; + else + return false; +} + + void IOChannel::EraseCharsBeforeCursor () { diff --git a/lldb/tools/driver/IOChannel.h b/lldb/tools/driver/IOChannel.h index e3c44b58d236..fbeaac4a8683 100644 --- a/lldb/tools/driver/IOChannel.h +++ b/lldb/tools/driver/IOChannel.h @@ -96,6 +96,9 @@ public: const char * GetPrompt (); + bool + EditLineHasCharacters (); + void EraseCharsBeforeCursor (); -- GitLab