reedline icon indicating copy to clipboard operation
reedline copied to clipboard

Overflow in completer

Open ClementNerma opened this issue 2 years ago • 2 comments

When writing the completion system with reedline::Completer, I stumbled across a problem:

If I say have a path in the list of completions that's larger than the terminal's width, it overflows and makes the whole completion's behaviour messy. Notably, it will redraw the entire completion list every time another option is selected.

Would it be possible to add a new struct option that would allow to provide a text to display AND a suggestion content? The former would be displayed in the user's terminal, while the second would be the output content.

ClementNerma avatar Jun 26 '23 06:06 ClementNerma

Can you clarify if this is just a messy display or a panic/inconsistent behavior caused by the overflow?

If I recall we have been cheating around some of the limitations of the current Completer trait by implementing our own Menu in nushell to get closer to the display behavior we want. We should be revisiting that Completer/Menu split. to get less messy implementation side requirements here. Not sure if just tacking a display option onto Suggestion is the right way to do this but investigations are welcome. But at the moment as there are not many people actively contributing to reedline, nushell requirements will probably dominate any decisions.

sholderbach avatar Jun 26 '23 09:06 sholderbach

Can you clarify if this is just a messy display or a panic/inconsistent behavior caused by the overflow?

If I recall we have been cheating around some of the limitations of the current Completer trait by implementing our own Menu in nushell to get closer to the display behavior we want. We should be revisiting that Completer/Menu split. to get less messy implementation side requirements here. Not sure if just tacking a display option onto Suggestion is the right way to do this but investigations are welcome. But at the moment as there are not many people actively contributing to reedline, nushell requirements will probably dominate any decisions.

It's just a messy display, basically the whole menu is re-drawn every time the focus goes on another option. No panic / crash / text overlap though.

ClementNerma avatar Jun 26 '23 09:06 ClementNerma