[Lldb-commits] [PATCH] D81001: [lldb] Display autosuggestion part in gray if there is one possible suggestion

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jul 24 02:31:35 PDT 2020


labath added a comment.

In D81001#2170570 <https://reviews.llvm.org/D81001#2170570>, @gedatsu217 wrote:

> I checked what's the sequence that actually gets output, and it was like below.
>
>   h\x1b[2melp frame\x1b[0m\x1b[1Ghe\x1b[2mlp frame\x1b[0m\x1b[1Gel\x1b[2mp frame\x1b[0m\x1b[1Gl
>
>
> Is it not good to check these characters in `expect_exact`?


The problem with that is that it might make the test too strict and susceptible to changes in libedit behavior (either due to different versions or different timings). There are many ways to achieve the same thing after all.
So, I would stick to the tail of the sequence which is printed after `l` is "pressed".

That said, are you sure this is the right sequence? `\x1b[1Gl` seems like it should print the `l` at column one, which does not sound right...

The sequence I got in this test was `l\x1b[2mp frame\x1b[0m\x1b[1G\r\x1b[9Cl`, which seems more believable. If I am decoding that correctly, it does:

- `l` - `l` is "pressed" and printed
- `\x1b[2mp frame\x1b[0m` - lldb prints "p frame" in faint
- `\x1b[1G` - libedit moves cursor to column 1
- `\r` - moves cursor to column 1 again (not sure why, probably to work around some terminal bugs)
- `\x1b[9C` - moves cursor 9 characters forward (`strlen("(lldb) he")`)
- `l` - redraws `l`

If that sequence works for you, then this is what I'd suggest putting in the test.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81001/new/

https://reviews.llvm.org/D81001





More information about the lldb-commits mailing list