You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When upgrading from Ratatui 0.26.1 to 0.26.2 my app started crashing when trying to display the attached file. lorem.txt
The panic is as follows:
thread 'main' panicked at /home/fri/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.26.2/src/text/line.rs:477:59:
byte index 92 is not a char boundary; it is inside 'σ' (bytes 91..93) of `Μεα θε δισαθ φαλλι οφφισιις. Ναμ δυις ιριυρε αδ. Φασιλις σεθερος αλβυσιυς ατ μει, μελ υθ ρεπυδιαρε ασεντιορ ινσιδεριντ. Σαεπε πρωβατυς ηις αν`[...]
I'm displaying this file in a Table, where each line is a cell in the table.
I'll update this bug report with a minimal project that crashes.
Note that Ratatui 0.26.1 worked fine.
To Reproduce
Expected behavior
Screenshots
Environment
OS: Linux
Terminal Emulator: Gnome Terminal
Font: Liberation Mono
Crate version: 0.26.2
Backend: Termion
Additional context
The bug was introduced by #987 .
The #987 PR doesn't take into consideration that UTF-8 uses multi-byte characters, so it's wrong to assume that
span.content[offset as usize..span_end]
is at char boundaries.
Moreover, you also must be very carful that some chars have a width of 1, some have a width of 2, and some have a width of 0, so the truncated function introduced in that PR needs to be refactored taking those things into consideration.
cc @TadoTheMiner
The text was updated successfully, but these errors were encountered:
Description
When upgrading from Ratatui 0.26.1 to 0.26.2 my app started crashing when trying to display the attached file.
lorem.txt
The panic is as follows:
I'm displaying this file in a Table, where each line is a cell in the table.
I'll update this bug report with a minimal project that crashes.
Note that Ratatui 0.26.1 worked fine.
To Reproduce
Expected behavior
Screenshots
Environment
Additional context
The bug was introduced by #987 .
The #987 PR doesn't take into consideration that UTF-8 uses multi-byte characters, so it's wrong to assume that
is at char boundaries.
Moreover, you also must be very carful that some chars have a width of 1, some have a width of 2, and some have a width of 0, so the
truncated
function introduced in that PR needs to be refactored taking those things into consideration.cc @TadoTheMiner
The text was updated successfully, but these errors were encountered: