ratatui-org / ratatui

Rust library that's all about cooking up terminal user interfaces (TUIs) 👨‍🍳🐀
https://ratatui.rs
MIT License
8.96k stars 274 forks source link

refactor(buffer): simplify set_stringn logic #1083

Closed EdJoPaTo closed 2 months ago

EdJoPaTo commented 2 months ago

Simplifies the logic. Instead of trying to figure out the max_offset in a seemingly complicated way keep the remaining_width and count down as long as there are characters left. This is way easier to understand for me what is going on.


Part of the improvements I did with #1049. As this is without _opt methods this can still panic (same as current code on wrong input).

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 94.1%. Comparing base (366c2a0) to head (46ef759).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1083 +/- ## ======================================= + Coverage 89.4% 94.1% +4.7% ======================================= Files 61 61 Lines 15440 14619 -821 ======================================= - Hits 13808 13764 -44 + Misses 1632 855 -777 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.