Open aryairani opened 5 years ago
Using stringToGraphemes
inside of makeLines
seems like a reasonable workaround that would parallel how we handle prefixes. (Relevant link, though you may have already seen it: https://github.com/judah/haskeline/wiki/ControlSequencesInPrompt)
I think you could convert the display
completions from strings to lists of graphemes, compute their lengths and pad and concatenate each line, then convert the lines back to strings right before outputting them. Did you run into problems with that approach?
No; I gave up immediately when length . stringToGraphemes
didn't give me what I wanted, but with this encouragement I will try again. :)
I understand a little better now, but the ANSI sequences generated by ansi-terminal aren't bracketed by '\STX'
, so stringToGraphemes
doesn't seem to help — is that right?
I know the unformatted string (and consequently its length) when I construct the Completion
, but it's not available at the point that we're ready to display
it.
I tried using ANSI sequences in the
display
field, but it threw off the alignment of the presented completions:I naively tried inserting a call to
stringToGraphemes
inCompletion.makeLines
but realized that's a different sort of thing. What do you think about some way to strip out escape sequences or to provide a length directly?