Comments (11)
I like the idea of newtype wrappers. Feels like a good idea to lean on Rust's type safety here, especially since flavors of this issue have been coming back for a while now.
I agree that adding newtype wrappers sounds like the "right" solution. But it also sounds significant and invasive.
Hmm, good point.
Could I suggests merging something like #613 now, and adding newtype wrappers in a separate PR?
Yes, merged!
from indicatif.
Sorry for the regression! Can you try if it works better with the changes from #608?
from indicatif.
@djc nope still crashes unfortunately
thread 'main' panicked at /Users/bes/.cargo/git/checkouts/indicatif-c82e440bcf1e0928/9169539/src/draw_target.rs:501:9:
assertion failed: self.orphan_lines_count <= self.lines.len()
from indicatif.
@bes Can you share your code, or provide instructions to reproduce?
from indicatif.
@smoelius here is a proof-of-concept https://github.com/bes/indicatif-assert-panic-poc
from indicatif.
I can reproduce the crash.
Can you give me a sense for what you expect that program's output to look like (i.e., if everything worked correctly)?
from indicatif.
Can you give me a sense for what you expect that program's output to look like (i.e., if everything worked correctly)?
Oh, I can just run it on a larger width to get that. 🤦
from indicatif.
The code in state.rs and multi.rs seem to have different ideas about what orphan_lines_count
represents.
The code in state.rs seems to regard it a number of lines
entries:
Line 155 in 8941d5e
Whereas the code in multi.rs seems to regard it as a visual line count (formerly real_len
):
Lines 315 to 323 in 8941d5e
When I wrote the fix for #582, I had the former in mind. But I see now (and understand why) @oli-obk had the latter in mind.
I think the code could be made to work either way. One approach just has to be chosen over the other.
Could one of the maintainers render a decision? Then I can try to prepare a fix.
from indicatif.
@smoelius thanks for digging in!
I don't have a strong preference so open to arguments that I'm wrong, but I feel like a "line" being a horizontal stripe across the window (that is, counting multiple for wrapped lines) is probably the more intuitive concept? In any case, would be great to use comments in all the relevant places to disambiguate how these numbers should be interpreted.
Could even go with newtype wrappers if there are a bunch of different places where we have to pass around context on these, but I feel like that's probably overkill here?
from indicatif.
Could even go with newtype wrappers if there are a bunch of different places where we have to pass around context on these, but I feel like that's probably overkill here?
I like the idea of newtype wrappers. Feels like a good idea to lean on Rust's type safety here, especially since flavors of this issue have been coming back for a while now.
from indicatif.
I like the idea of newtype wrappers. Feels like a good idea to lean on Rust's type safety here, especially since flavors of this issue have been coming back for a while now.
I agree that adding newtype wrappers sounds like the "right" solution. But it also sounds significant and invasive.
Could I suggests merging something like #613 now, and adding newtype wrappers in a separate PR?
Note that there is still the question of what orphan_lines_count
should count: slice entries or vertical lines?
@djc suggested the latter. But I ran into trouble with this, and so I went with the former.
If orphan_lines_count
remains a number of slice entries, then I expect a PR adding newtype wrappers would have to incorporate something like #613.
from indicatif.
Related Issues (20)
- Finished progress bars are not preserved in `MultiProgress::println` HOT 6
- `{msg}` `.set_message(Cow<'static, str>)` design unnecessarily requires allocation HOT 3
- Question: How to get latest progress bar state string HOT 3
- Git repo is missing tag for v0.17.7 HOT 1
- Add gifs/videos in readme for each example HOT 1
- Hidden as an attribute on Style not ProgressBar HOT 3
- Use with Zenity HOT 7
- Intermittent `style::tests::wide_element_style` failure HOT 2
- ‘percent_precise’ do not work HOT 4
- examples/fastbar.rs rendering is different on Windows git-bash than CMD or PowerShell HOT 3
- [Meta] missing release entries for 0.17.6 and up HOT 3
- MultiProgress falls apart if the number of ProgressBars excedes the number of lines in a terminal HOT 1
- Feature Req.: Human readable `per_sec` rate HOT 3
- Using ⚙️ emoji in ProgressBar spinner message causes unnessecary line breaks HOT 23
- How do I get the progress bar to align under my design? HOT 1
- MultiProgress second ProgressBar extremely delayed HOT 3
- Stacked progress bar HOT 2
- Adding/removing progress bar spinners leaves newlines HOT 3
- No progress bar in docker logs HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from indicatif.