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

keepWords doesn't work during typing animation #867

Closed
jcubic opened this issue Mar 28, 2023 · 12 comments
Closed

keepWords doesn't work during typing animation #867

jcubic opened this issue Mar 28, 2023 · 12 comments
Labels
Bug resolved if issue is resolved, it will be open until merge with master

Comments

@jcubic
Copy link
Owner

jcubic commented Mar 28, 2023

Issue summary

When you echo with typing animation and keepWords it the word wrapping only happen after the animation

Expected behavior

keepWords should work during animation

Actual behavior

I only work after the animation finishes

Steps to reproduce

  1. Open CodePen demo
  2. Change the echo to:
await term.echo(para, { typing: true, delay: 50, keepWords: true });

Browser and OS

NA

@jcubic jcubic added the Bug label Mar 28, 2023
@jmacwhyte
Copy link

It would appear keepWords and wrapping also do not work correctly if you echo something that is too long to fit on the current line. Is this related?

@jcubic
Copy link
Owner Author

jcubic commented Jun 2, 2023

@jmacwhyte Are you talking about animation? Can you show an example?

@jmacwhyte
Copy link

@jcubic Apologies, the issue I encountered was not related to animation. It appears to be some sort of rendering issue. On my computer, text entered manually will be indented on the left by 1px until you press enter, then the indent disappears. If lined up exactly with word wrap, this can cause characters to jump from a second line back to the first.

@jcubic
Copy link
Owner Author

jcubic commented Jun 2, 2023

What browser do you use and what OS? Also, can you create a demo that reproduces the issue? Just in case I can't reproduce it can you record a video of the bug?

@jmacwhyte
Copy link

I'm using chrome on OSX. Here is the setup (very boring): https://jsfiddle.net/03ngcLwq/

I zoomed in to make it easy to see the issue, then recorded this video. I start by typing "12345" and you can see it looks like it is doing wordwrap because the 5 moves down to the second line. But when I press enter, everything shifts enough for the 5 to be on the same line. For the following lines, you can see they don't line up perfectly until I press enter. When not zoomed in, it seems to be a change of only 1px.

Screen.Recording.2023-06-02.at.7.57.58.PM.mov

@jcubic
Copy link
Owner Author

jcubic commented Jun 2, 2023

Oh, I see. This is kind of off by one error, because the cursor can't fit into the space. This has nothing to do with word wrapping. I'm not sure if you can do anything about this. But you can report an issue for this. I will look at it when I will have time.

Do you really have a use case for this, or just was testing how it performs in such extreme conditions?

@jcubic
Copy link
Owner Author

jcubic commented Jun 2, 2023

I've just tested it on Chrome Linux and I don't see a jump but the first line gets one less character.

@jmacwhyte
Copy link

Do you really have a use case for this

No, it isn't very important :)

I was trying to learn how wordwrapping works, and made the screen quite small just so I wouldn't have to type as much before it wrapped. That's when I noticed the behaviour, which at first confused me because I thought it was wrapping inconsistently.

I think I now have everything I need. Thanks for the amazing project!

@jcubic
Copy link
Owner Author

jcubic commented Jun 3, 2023

Created an issue for it. It was long ago when I was testing wrapping, there are a lot of unit tests for this, but I think that this is something with CSS and the Browser that's why it needs to be tested manually (there are no visual tests).

@jcubic
Copy link
Owner Author

jcubic commented Jun 3, 2023

Just tested with the prompt, it only happens when the prompt is an empty string.

@jcubic
Copy link
Owner Author

jcubic commented Jun 3, 2023

The issue with wrapping is solved in the devel branch. It was caused by the prompt being Zero-With Space in DOM when the prompt was empty.

@jmacwhyte
Copy link

Awesome, great work! Thanks for the quick action.

@jcubic jcubic added the resolved if issue is resolved, it will be open until merge with master label Dec 30, 2023
@jcubic jcubic closed this as completed Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug resolved if issue is resolved, it will be open until merge with master
Projects
None yet
Development

No branches or pull requests

2 participants