[Lldb-commits] [lldb] [lldb] Correct handling of ANSI codes in command option help (PR #178653)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 9 06:11:51 PST 2026


================
@@ -272,9 +272,13 @@ void Options::OutputFormattedUsageText(Stream &strm,
       actual_text.append("] ");
     }
   }
-  actual_text.append(
-      ansi::FormatAnsiTerminalCodes(option_def.usage_text, use_color));
-  const size_t visible_length = ansi::ColumnWidth(actual_text);
+  actual_text.append(option_def.usage_text);
+
+  const std::string text_without_ansi =
+      ansi::FormatAnsiTerminalCodes(actual_text, false);
----------------
JDevlieghere wrote:

I was convinced this was wrong until I parsed the `false` at the end. I think `StripAnsiTerminalCodes` would be better suited here. 

https://github.com/llvm/llvm-project/pull/178653


More information about the lldb-commits mailing list