widget: expose truncation status of Selectable

This commit adds an exported method to enable widgets to detect
when the text displayed by a Selectable has been truncated. This
can be used to implement proper show-full-text-in-an-overlay
behavior in a parent widget. I haven't attempted to implement
that in core yet, as it is a complex feature involving animation
and pointer interaction.

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This commit is contained in:
Chris Waldon
2023-03-23 11:02:51 -04:00
committed by Elias Naur
parent 959f5889a1
commit 5e6e1217da
2 changed files with 12 additions and 0 deletions
+6
View File
@@ -447,6 +447,12 @@ func (e *textView) MoveCoord(pos image.Point) {
e.caret.xoff = 0
}
// Truncated returns whether the text in the textView is currently
// truncated due to a restriction on the number of lines.
func (e *textView) Truncated() bool {
return e.index.truncated
}
func (e *textView) layoutText(lt *text.Shaper) {
e.Seek(0, io.SeekStart)
var r io.Reader = e