[Lldb-commits] [lldb] [lldb] Highlight matching keywords in apropos output (PR #194997)
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Thu Apr 30 02:56:29 PDT 2026
DavidSpickett wrote:
I was thinking of the function that outputs command usage rather than help, but anyway I did find a bug.
This term is found twice:
<img width="702" height="504" alt="Screenshot from 2026-04-30 10-38-19" src="https://github.com/user-attachments/assets/741ff284-5b4b-4f53-a20b-a1556cbdc6b0" />
However when the window is small enough to split it across two lines, it's not highlighted:
<img width="948" height="293" alt="Screenshot from 2026-04-30 10-37-24" src="https://github.com/user-attachments/assets/4bd905d9-9634-409e-a573-4b34c78ff026" />
Because the highlight is done after line splitting.
I sigh every time we have to copy a string, but if we make a copy and highlight that before splitting, it works:
<img width="951" height="292" alt="Screenshot from 2026-04-30 10-48-14" src="https://github.com/user-attachments/assets/2a1b5a03-f852-44af-9d39-04b82026546e" />
(I had to use a longer term because the highlight characters probably make the text "longer" despite being invisible)
Though I want to note that the highlight is actually applying to the indent as well here:
<img width="951" height="292" alt="Screenshot from 2026-04-30 10-48-32" src="https://github.com/user-attachments/assets/9e6440f4-5de9-4ae7-bb09-d77b2df7b1d5" />
But because it's colour, colour doesn't visibly apply to spaces. Whereas for the command text we had underline, which does visibly apply to spaces. I fixed that by using ANSI indents to indent if use_color was true.
This function is missing some ANSI awareness but not enough to be visible bugs in this case. Perhaps it could be replaced with `ansi::OutputWordWrappedLines`, but not required for this PR.
https://github.com/llvm/llvm-project/pull/194997
More information about the lldb-commits
mailing list