[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


================
@@ -287,6 +287,79 @@ inline size_t ColumnWidth(llvm::StringRef str) {
   return llvm::sys::locale::columnWidth(stripped);
 }
 
+// This function converts an index into "visible" text (text with ANSI codes
+// removed) into an index into the actual data of the text (which includes ANSI
+// codes). That actual index should be used when printing the actual data.
----------------
JDevlieghere wrote:

This should at least mention how this treats UTF-8, which is another common source of divergence between the visible and actual length. Almost everywhere we support escape codes, we also support unicode. 

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


More information about the lldb-commits mailing list