AMythicDev / minus

An asynchronous, runtime data feedable terminal paging library for Rust
https://crates.io/crates/minus/
Apache License 2.0
316 stars 23 forks source link

Initially outputting a string more than the terminal height, leaves the screen blank until a key is pressed #21

Closed rezural closed 3 years ago

rezural commented 3 years ago

I have a branch which demonstrates this bug:

https://github.com/rezural/minus/tree/large-page-bug

cargo run --example large_page_bug --features='async_std_lib'

you will see that the initial output is blank. also, uncomment https://github.com/rezural/minus/blob/large-page-bug/examples/large_page_bug.rs#L17

there is a similar bug that doesnt output the last chunk of string that goes over the height.

I'm debugging now, but you may have a quick fix.

Thanks for the library!

AMythicDev commented 3 years ago

Thanks for the issue and PR. I just wanted to ask whether #22 is complete and ready for merging

rezural commented 3 years ago

There is nothing to test the behaviour of dynamic_paging at the moment?

(I cannot find any relevant tests).

Other than that it works as expected.

Should be ready!

rezural commented 3 years ago

OK, there is a different fix up there. I had something similar initially, & this handles if the initial string is longer than the height of the terminal.

But you output say 10 lines at a time, the last 10 will not be displayed until a key is pressed.

Screenshot from 2021-02-16 16-43-14

You will note that there is a gap of 10 lines above, even though the code (in the above branch example) outputs more than that available text to the library.

AMythicDev commented 3 years ago

This is your second bug which I haven't worked on. Does your patch fixes it?

rezural commented 3 years ago

yep, it fixes both.

AMythicDev commented 3 years ago

Well I am gonna merge yours instead of mine

rezural commented 3 years ago

OK,

I'll try to add something to test dynamic_paging, to make sure this fix is tested, and stays.

any advice on adding test code to test this async func?

Thanks!

AMythicDev commented 3 years ago

Well I don't have anything personal and since it's hard to write tests for a library that provides interface to a user rather than providing nice functions to other projects, I have never really looked into it. Really thankful to you for working on it

rezural commented 3 years ago

OK,

testing the async code will be kinda hard, and require changing at least async_std_updating, run, and init::dynamic_paging functions to accept the out parameter.

Would be cool to have tests for this, but you would know better if it's actually possible.

Thanks