From 82a7d9834286acc17d9b36851c065cadec61d36f Mon Sep 17 00:00:00 2001 From: Enrico Granata Date: Thu, 7 Jul 2011 00:38:40 +0000 Subject: new detailed descriptions for type summary add and type format add some changes to the help system code for better display of long help text -p and -r flags now also work for type format add llvm-svn: 134574 --- lldb/source/Interpreter/CommandInterpreter.cpp | 43 ++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'lldb/source/Interpreter/CommandInterpreter.cpp') diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index bcbd5f8bfcf..8e499d7de43 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -2013,6 +2013,49 @@ CommandInterpreter::OutputFormattedHelpText (Stream &strm, strm.IndentLess(indent_size); } +void +CommandInterpreter::OutputHelpText (Stream &strm, + const char *word_text, + const char *separator, + const char *help_text, + uint32_t max_word_len) +{ + int indent_size = max_word_len + strlen (separator) + 2; + + strm.IndentMore (indent_size); + + StreamString text_strm; + text_strm.Printf ("%-*s %s %s", max_word_len, word_text, separator, help_text); + + const uint32_t max_columns = m_debugger.GetTerminalWidth(); + bool first_line = true; + + size_t len = text_strm.GetSize(); + const char *text = text_strm.GetData(); + + uint32_t chars_left = max_columns; + + for (uint32_t i = 0; i < len; i++) + { + if ((text[i] == ' ' && ::strchr((text+i+1), ' ') && chars_left < ::strchr((text+i+1), ' ')-(text+i)) || text[i] == '\n') + { + first_line = false; + chars_left = max_columns - indent_size; + strm.EOL(); + strm.Indent(); + } + else + { + strm.PutChar(text[i]); + chars_left--; + } + + } + + strm.EOL(); + strm.IndentLess(indent_size); +} + void CommandInterpreter::AproposAllSubCommands (CommandObject *cmd_obj, const char *prefix, const char *search_word, StringList &commands_found, StringList &commands_help) -- cgit v1.2.3