-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fix wrapping bug on lists #255
Conversation
var lines = content.split(/\n/); | ||
this.height = lines.length; | ||
var lines = content.split(/\n/), | ||
width = cliWidth(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use one var
statement per line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, fixed!
Actually, there's an issue with this. It counts hidden characters such as color and incorrectly assumes the length of the line. Actual length of the line needs to be detected either by rendering then counting or somehow flattening colors and text decoration. |
Yeah, you can use So this is not mergeable as is, but I might base something out of your solution. |
That's cool! Glad I could help somehow. Any rough ETA on a fix?
|
My fix is on master now. |
This should fix the issue #214 where wrapping lines caused extra lines to be added to the prompt. The problem was where the lines wrapped and it caused the screens count of lines to clear to fall out of sync. I'm not exactly sure how to unit test this but from manual tests, it seems to work fine. Another potential bug is when the terminal resizes, it will go out of sync because it only updates the line count on render so that will need to be accounted for in future.
Behaviour differences
Here is a demonstration of the behaviour differences introduced by this PR:
master
): https://asciinema.org/a/c11odt2jpxncuz7jmdaymefchwrapping-bug
): https://asciinema.org/a/bsaszkvz3skkixpgtuzoy40re