-
Notifications
You must be signed in to change notification settings - Fork 23
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
Feeding minus with text from a network call results in corrupted text until resizing #66
Comments
Thanks for filing up the issue. I am actually super busy right now but I will still try to get a fix ready. If you want to help, you can file a PR with the fix. Also if you need any help, you can hop on our Discord or Matrix room. |
Hi, thank for your response! I have at least a workaround: while let Some(chunk) = stream.next().await {
let bytes: Bytes = chunk.unwrap();
let text = bytes.to_str_lossy().to_string();
// only write one line at a time
for line in text.lines() {
writeln!(pager, "{}", line).unwrap();
}
} If I wrote one line at a time it works as expected. I assume the error occurs when writing long lines which contains |
I have fixed the issue and did the test that you had initially performed. |
I know this issue is closed, but I am experiencing the same problem. My program makes REST calls with reqwest, and there is always a blank line in the output. Because my program can cache, when data is pulled from the cache there is no blank line (reqwest is never called). I've tried all the tokio settings, and tried writing the data one line at a time but nothing fixes it. And, resizing the terminal causes the blank like to go away. minus version is "5.3", tokio is "1.29" and reqwest is "0.11" (they are all the latest at this time). Since the code is open source and on crates.io, you should be able reproduce it with the following:
|
I will look at it tomorrow. |
@anewton1998 So finally I got some information regarding the issue. I setted up logging to get more info and I discovered that line 7 of the output appears empty in the logs but gets displayed in the output. That's kinda strange and I don't see it with any other lines. I tried to take a look at the actual lines sent by the main program but for unknown reasons the program just suddenly stopped working. Maybe I have to compile your whole program again. (It takes a good amount of time to compile 😞) |
Perhaps you are being rate-limited by the domain registry's server. Maybe try an RIR query:
Thanks for looking at this. It is a very hard problem to solve. I played around with all the Tokio features but nothing changes the behavior. You can also see that these blank lines do not show up when sending straight to the console. This can be demonstrated with the |
The issue is being caused due to |
Would it help if I moved from the |
I am not sure cuz it is difficult to get any sensible information from all the info that I collect so far. There are several calls to |
When I attempt to use |
This is kinda obvious as minus locks the Stdout so that other stuff cannot break the display. |
So finally I fixed that. If you want to know more on why all the bug occurred, you can check the commit message. |
Thanks for chasing down the bug. I just figured out a way to get tracing_subscriber to work using with_writer. Is there anything I need to do to stop the behavior of sending data to minus before it is fully initialized? Doing so would mean I could get rid of my workarounds for tracing_subscriber and termimad. |
Well can we just move to a Discussion so that this issue doesn't become filled with unrelated topics. I hope you don't mind. |
Describe the bug
Hi,
I'm using reqwest and tokio to make an async network call. Utilizing the
stream
feature of reqwest I'm reading chunks of the response text andwrite!
it into minus using thedynamic_paging
feature.Then the text, line numbers and so forth gets corrupted until I resize the terminal window, which (I assume) causes a refresh of the view.
To Reproduce
Cargo.toml
Screenshots
This is the immediate result:
As you can see, the line numbering is wrong and the content ins't correctly display. However, if I now resize the terminal everything is fine:
Desktop:
minus
Version: 5.0.1Additional context
When I don't stream the text-chunks but instead using the
text
method from reqwest, which loads the complete text into a single string with a singlewrite!
it works like a charm.The text was updated successfully, but these errors were encountered: