summaryrefslogtreecommitdiff
path: root/lldb/source/Core/IOHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Core/IOHandler.cpp')
-rw-r--r--lldb/source/Core/IOHandler.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/lldb/source/Core/IOHandler.cpp b/lldb/source/Core/IOHandler.cpp
index 4021a6d7f327..6cf09aaa7f9d 100644
--- a/lldb/source/Core/IOHandler.cpp
+++ b/lldb/source/Core/IOHandler.cpp
@@ -1,4 +1,4 @@
-//===-- IOHandler.cpp -------------------------------------------*- C++ -*-===//
+//===-- IOHandler.cpp -----------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -125,6 +125,8 @@ void IOHandlerStack::PrintAsync(Stream *stream, const char *s, size_t len) {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
if (m_top)
m_top->PrintAsync(stream, s, len);
+ else
+ stream->Write(s, len);
}
}
@@ -251,9 +253,9 @@ IOHandlerEditline::IOHandlerEditline(
m_input_sp && m_input_sp->GetIsRealTerminal();
if (use_editline) {
- m_editline_up.reset(new Editline(editline_name, GetInputFILE(),
- GetOutputFILE(), GetErrorFILE(),
- m_color_prompts));
+ m_editline_up = std::make_unique<Editline>(editline_name, GetInputFILE(),
+ GetOutputFILE(), GetErrorFILE(),
+ m_color_prompts);
m_editline_up->SetIsInputCompleteCallback(IsInputCompleteCallback, this);
m_editline_up->SetAutoCompleteCallback(AutoCompleteCallback, this);
// See if the delegate supports fixing indentation
@@ -287,12 +289,20 @@ void IOHandlerEditline::Deactivate() {
m_delegate.IOHandlerDeactivated(*this);
}
+void IOHandlerEditline::TerminalSizeChanged() {
+#if LLDB_ENABLE_LIBEDIT
+ if (m_editline_up)
+ m_editline_up->TerminalSizeChanged();
+#endif
+}
+
// Split out a line from the buffer, if there is a full one to get.
static Optional<std::string> SplitLine(std::string &line_buffer) {
size_t pos = line_buffer.find('\n');
if (pos == std::string::npos)
return None;
- std::string line = StringRef(line_buffer.c_str(), pos).rtrim("\n\r");
+ std::string line =
+ std::string(StringRef(line_buffer.c_str(), pos).rtrim("\n\r"));
line_buffer = line_buffer.substr(pos + 1);
return line;
}
@@ -300,7 +310,7 @@ static Optional<std::string> SplitLine(std::string &line_buffer) {
// If the final line of the file ends without a end-of-line, return
// it as a line anyway.
static Optional<std::string> SplitLineEOF(std::string &line_buffer) {
- if (llvm::all_of(line_buffer, isspace))
+ if (llvm::all_of(line_buffer, llvm::isSpace))
return None;
std::string line = std::move(line_buffer);
line_buffer.clear();
@@ -443,7 +453,7 @@ const char *IOHandlerEditline::GetPrompt() {
}
bool IOHandlerEditline::SetPrompt(llvm::StringRef prompt) {
- m_prompt = prompt;
+ m_prompt = std::string(prompt);
#if LLDB_ENABLE_LIBEDIT
if (m_editline_up)
@@ -458,7 +468,7 @@ const char *IOHandlerEditline::GetContinuationPrompt() {
}
void IOHandlerEditline::SetContinuationPrompt(llvm::StringRef prompt) {
- m_continuation_prompt = prompt;
+ m_continuation_prompt = std::string(prompt);
#if LLDB_ENABLE_LIBEDIT
if (m_editline_up)