reedline icon indicating copy to clipboard operation
reedline copied to clipboard

Rendering issue with ColumnarMenu and Suggestions that have a description

Open steveklabnik opened this issue 3 years ago • 2 comments

Platform I found this on Windows 11, but believe it to be not specific. Terminal software Windows Terminal, both nushell and powershell

Describe the problem you are observing.

Steps to reproduce

  1. create a sample program that shows the issue. The fastest way to do this is to use the "completions" example in the repo. The only problem is, it uses the DeafultCompleter, which doesn't take descriptions for the completion items. However, we can apply a very small diff to reedline itself:
diff --git a/src/completion/default.rs b/src/completion/default.rs
index 812c740..d4ac027 100644
--- a/src/completion/default.rs
+++ b/src/completion/default.rs
@@ -98,7 +98,7 @@ impl Completer for DefaultCompleter {

                                     Suggestion {
                                         value: format!("{}{}", span_line, ext),
-                                        description: None,
+                                        description: Some(String::from("extra")),
                                         extra: None,
                                         span,
                                         append_whitespace: false,

And now cargo run --example completions will show the issue.

  1. Run the example
  2. type "he" and then hit tab

The very first time you do this, you'll get weird rendering:

image

If you hit tab again, or an arrow key, or anything else, it'll fix itself:

image

and then on future renderings, it does the right thing.

This makes me really suspect it's some initial state being set up just incorrectly, but have not yet tried to actually diagnose the issue.

steveklabnik avatar Dec 12 '22 19:12 steveklabnik

Good catch! menus are witchcraft, confirmed Can confirm that annoying behavior on Ubuntu/WSL. Can look into it in a few days.

sholderbach avatar Dec 13 '22 13:12 sholderbach

I'm also hitting this issue: image

And after pressing tab it will fix itself just like the OP: image

HKalbasi avatar May 22 '24 18:05 HKalbasi