[Lldb-commits] [PATCH] D81001: [lldb] Display autosuggestion part in gray if there is one possible suggestion

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jun 12 03:45:19 PDT 2020


labath added inline comments.


================
Comment at: lldb/source/Host/common/Editline.cpp:1051-1052
+unsigned char Editline::TypedCharacter(int ch) {
+  std::string typed = std::string(1, ch);
+  typed = typed[0];
+  el_insertstr(m_editline, typed.c_str());
----------------
the second line is redundant. `std::string typed(1, ch)` is enough. (Though I might also consider `const char typed[] = {ch, 0};`)


================
Comment at: lldb/source/Host/common/Editline.cpp:1068-1069
+                             ansi::FormatAnsiTerminalCodes("${ansi.normal}");
+  fprintf(m_output_file, "%s", typed.c_str());
+  fprintf(m_output_file, "%s", to_add_color.c_str());
+  fflush(m_output_file);
----------------
maybe `fputs(typed.c_str(), m_output_file)`


================
Comment at: lldb/source/Host/common/Editline.cpp:1070
+  fprintf(m_output_file, "%s", to_add_color.c_str());
+  fflush(m_output_file);
+  MoveCursor(CursorLocation::BlockEnd, CursorLocation::EditingPrompt);
----------------
Is the flush still necessary after the switch to `m_output_file`?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81001/new/

https://reviews.llvm.org/D81001





More information about the lldb-commits mailing list