================
@@ -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.
+//
+// If a character is preceeded by an ANSI code, the returned actual index will
+// point to that ANSI code. As formatting that visible character requires the
+// code.
+//
+// This logic does not extend to whole words. This function assumes you are not
+// going to split up the words of whatever text you pass in here. Making sure
+// not to split words is the responsibility of the caller of this function.
+//
+// Returns a pair containing {visible index, actual index}. This may be passed
+// back to the function later as "hint" to allow it to skip ahead if you are
+// asking for a visible index equal or greater to the one in the hint.
+//
+// The function assumes that the hint provided is correct, even if it refers
+// to an index that does not exist. If the hint is for the exact requested
+// visible index, it will return the hint, without checking the string at all.
----------------
JDevlieghere wrote:

This can be Doxygen (`///`) and should precede the function rather than the 
struct. 

https://github.com/llvm/llvm-project/pull/178653
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to