[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
Tue Aug 11 04:34:30 PDT 2020

labath added a comment.

Slightly late to the party, but I want to point out that there _is_ an escape code for clearing a line:

  CSI n K 	--	Erase in Line --	Erases part of the line. If n is 0 (or missing), clear from cursor to the end of the line. If n is 1, clear from cursor to beginning of the line. If n is 2, clear entire line. Cursor position does not change. 

It sounds like it should be sufficient to slap this to the end of the autosuggested text, before the cursor is moved in any way.

That said I'm not sure what exactly will this do in case the suggested text spans multiple lines (because it's longer than the terminal width). It's possible inserting spaces will handle that better, but it's also possible it will not -- I can imagine that creating a new line in an autosuggestion will hopelessly confuse lldb/editline. In either case, I think it'd be good to verify how we handle commands which span multiple lines.

But that can come as a separate patch.



More information about the lldb-commits mailing list