David Spickett 900f70258b
[lldb] Indent option help with ANSI cursor codes when possible. (#183558)
This avoids formatting empty space when a range of text formatted by
ANSI codes is split across lines.

This is not currently done in any option, but the `${...}` syntax we
have does support marking any range of text, so it could be done in
future, and fixing it is simple.

As an example, if I change a breakpoint option:
```
             "${S}et the breakpoint only in this shared library.  Can repeat "
-            "this option multiple times to specify multiple shared libraries.">;
+            "this option multiple ${times to specify multiple} shared libraries.">;
```
This applies the underline to words that will be split across lines. In
the outputs below, `^` represents an underlined character.

With spaces:
```
       -s <shlib-name> ( --shlib <shlib-name> )
            Set the breakpoint only in this shared library.  Can repeat this option multiple times to
                                                                                             ^^^^^^^^
            specify multiple shared libraries.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
The indent and the text are underlined, this is not what we want.

With cursor movement:
```
       -s <shlib-name> ( --shlib <shlib-name> )
            Set the breakpoint only in this shared library.  Can repeat this option multiple times to
                                                                                             ^^^^^^^^
            specify multiple shared libraries.
            ^^^^^^^^^^^^^^^^
```
Only the text is underlined, which is correct.

If we are not allowed to use ANSI (use-color is off), then the
descriptions will be stripped of ANSI anyway, so this is not a problem.

---------

Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com>
2026-03-02 09:58:26 +00:00
..