From cfca06d7963fa0909f90483b42a6d7d194d01e08 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 26 Jul 2020 19:36:28 +0000 Subject: Vendor import of llvm-project master 2e10b7a39b9, the last commit before the llvmorg-12-init tag, from which release/11.x was branched. --- lldb/source/Core/IOHandler.cpp | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'lldb/source/Core/IOHandler.cpp') 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 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_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 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 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 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) -- cgit v1.2.3