[Lldb-commits] [lldb] [lldb] Improve editline completion formatting (PR #116456)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Mon Nov 18 23:11:25 PST 2024
================
@@ -927,12 +927,87 @@ unsigned char Editline::BufferEndCommand(int ch) {
static void
PrintCompletion(FILE *output_file,
llvm::ArrayRef<CompletionResult::Completion> results,
- size_t max_len) {
+ size_t max_completion_length, size_t max_length) {
+ constexpr size_t ellipsis_length = 3;
+ constexpr size_t padding_length = 8;
+ constexpr size_t separator_length = 4;
+
+ const size_t description_col =
+ std::min(max_completion_length + padding_length, max_length);
+
for (const CompletionResult::Completion &c : results) {
- fprintf(output_file, "\t%-*s", (int)max_len, c.GetCompletion().c_str());
- if (!c.GetDescription().empty())
- fprintf(output_file, " -- %s", c.GetDescription().c_str());
- fprintf(output_file, "\n");
+ if (c.GetCompletion().empty())
+ continue;
+ ;
----------------
labath wrote:
stray semicolon
https://github.com/llvm/llvm-project/pull/116456
More information about the lldb-commits
mailing list