I’m trying to create a table with each cell to be a single line text which will replace overflowed text with ‘…’, or at least clip the overflowed text.
I have no idea how to achieve this, the table’s layout is something like this:
Column
Container - table head
Row
Container - table body row #1
Row
Container - the cell
Text - the text
I’ve tried invoking wrapping(Wrapping::None) on Text, but wrapping is still happening.
I can mimic a clipped single line text by fixing the height of Text widget, but I don’t think this is a good method because I don’t know how to get the rendered size of a glyph.
You can combine Text.wrapping with Container.clip. If by any chance you’re using tiny-skia instead of wgpu, you will find that Container.clip doesn’t work properly with it, but Text.wrapping should.
I don’t think there’s is an implementation of clipping with an ellipsis yet.
It looks like Wrapping::None does nothing, did I use it in a wrong way?
Update:
I have a feeling that the wrapping field of Text is not functioning, because no matter I use Wrapping::None, Wrapping::Word, Wrapping::Glyph or Wrapping::WordOrGlyph, I observe no difference in rendered interfaces.
And I think I’m using wgpu as I saw a lot of rows starting with wgpu_core in my log.
Update 2:
Ah, I finally figured it out, I just need to use the latest version from github, not the version from crates.io, there might be an unpublished bug fix.