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

inputs get messed up when a line overflows #7

Open
jdx opened this issue Jan 17, 2024 · 10 comments · May be fixed by #36
Open

inputs get messed up when a line overflows #7

jdx opened this issue Jan 17, 2024 · 10 comments · May be fixed by #36
Labels
bug Something isn't working

Comments

@jdx
Copy link
Owner

jdx commented Jan 17, 2024

2024-01-17 11 02 34

@roele
Copy link
Collaborator

roele commented Jan 19, 2024

I am currently not able to reproduce this (tried bash, fish, zsh)...

@roele
Copy link
Collaborator

roele commented Jan 20, 2024

Seems to happen if the window width is narrow and some of the content (e.g "help") overflows to a new line.

@jdx
Copy link
Owner Author

jdx commented Jan 20, 2024

oh I probably never accounted for the help overflowing

@roele
Copy link
Collaborator

roele commented Jan 20, 2024

not quite sure how we could deal with this. i have a similar obstacles implementing text input.

@jdx
Copy link
Owner Author

jdx commented Jan 20, 2024

we have to make self.height not use just .lines() but also figure out how many times each line will overflow.

A couple of things will help with this:

@jdx
Copy link
Owner Author

jdx commented Jan 20, 2024

I guess the logic should be something like:

self.height = output.lines().count() + output.lines().map(|l| measure_text_width(l).len() / WIDTH).sum()

@roele
Copy link
Collaborator

roele commented Jan 20, 2024

i see, something around iterating the lines and add 1 more for each that is longer than the terminal width

@roele
Copy link
Collaborator

roele commented Jan 21, 2024

It seems certainly related to the help texts overflowing the terminal width but it seems, even adding lines by a more elaborate height calculation does not seem to help. Needs further investigation...

let max_width = self.term.size().1 as usize;
...
self.height = output
                 .lines()
                 .map(|l| measure_text_width(l).div_ceil(max_width))
                 .sum::<usize>();
...

@roele
Copy link
Collaborator

roele commented Jan 24, 2024

did not find a fix yet, calling self.term.clear_last_lines(self.height)?; with an increased height does not seem to work

@roele roele added the bug Something isn't working label Jan 24, 2024
@roele roele changed the title mutliselect gets messed up on last page when using arrow down inputs get messed up when a line overflows Jan 31, 2024
@roele
Copy link
Collaborator

roele commented Jan 31, 2024

this seems to affect all inputs with lines which might overflow, hence renaming

@roele roele linked a pull request Jan 31, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants