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

echo newline:false does not wrap text until resize #952

Closed
ordo-n opened this issue Jun 21, 2024 · 5 comments
Closed

echo newline:false does not wrap text until resize #952

ordo-n opened this issue Jun 21, 2024 · 5 comments
Labels
Bug resolved if issue is resolved, it will be open until merge with master

Comments

@ordo-n
Copy link

ordo-n commented Jun 21, 2024

Issue summary

When I use multiple
term.echo('qwerty', {newline:false}');
it correctly doesnt add a newline, but it incorrectly doesnt process newlines until I resize the window

Expected behavior

Should not have to resize window for newline to appear

Actual behavior

Trails off to the right

Steps to reproduce

for(let i = 0; i < 100; i+=1)
term.echo('qwerty', {newline:false}');

Browser and OS

All browsers

Additional notes

before resize
image
after resize
image

@ordo-n ordo-n added the Bug label Jun 21, 2024
@ordo-n ordo-n changed the title echo newline:false does not process newlines echo newline:false does not process newlines until resize Jun 21, 2024
@jcubic
Copy link
Owner

jcubic commented Jun 21, 2024

Thanks for the report, here is repro https://codepen.io/jcubic/pen/wvbmpgX

This is another problem with newline: false that was integrated with the library by a contributor. Since it was added, there were a lot of bugs that we didn't think about when merging the PR.

@jcubic jcubic changed the title echo newline:false does not process newlines until resize echo newline:false does not wrap text until resize Jun 21, 2024
@jcubic
Copy link
Owner

jcubic commented Jun 22, 2024

You can fix this with a hack:

for(let i = 0; i < 100; i+=1) {
    term.echo('qwerty', { newline: false });
    term.update(-1, ...term.get_output(true).pop());
}

This will force having a clean partial render (partial is the output without newline), by refreshing the last line after each echo.

I will probably do something similar inside the library, but without creating garbage from Terminal::get_output(). If there are two partials in a row, they need to be processed as one.

@jcubic
Copy link
Owner

jcubic commented Jun 22, 2024

It seems this don't solve the problem.

@jcubic
Copy link
Owner

jcubic commented Jul 3, 2024

It's a challenging bug, it may take a while to fix. I'm not sure how to handle one edge case.

jcubic added a commit that referenced this issue Jul 7, 2024
jcubic added a commit that referenced this issue Jul 7, 2024
@jcubic jcubic added the resolved if issue is resolved, it will be open until merge with master label Jul 7, 2024
@jcubic jcubic closed this as completed Jul 9, 2024
@jcubic
Copy link
Owner

jcubic commented Jul 10, 2024

The bug was fixed and released with version 2.42.1.

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