Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alignment surprise when displaying tab-completions #114

Open
aryairani opened this issue Mar 3, 2019 · 4 comments
Open

alignment surprise when displaying tab-completions #114

aryairani opened this issue Mar 3, 2019 · 4 comments

Comments

@aryairani
Copy link

image

I tried using ANSI sequences in the display field, but it threw off the alignment of the presented completions:

image

I naively tried inserting a call to stringToGraphemes in Completion.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?

@judah
Copy link
Collaborator

judah commented Mar 9, 2019

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?

@aryairani
Copy link
Author

No; I gave up immediately when length . stringToGraphemes didn't give me what I wanted, but with this encouragement I will try again. :)

@aryairani
Copy link
Author

aryairani commented Mar 10, 2019

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?

@aryairani
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants