-
Notifications
You must be signed in to change notification settings - Fork 26.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Text overflow with ellipsis is weird and ugly by design #18761
Comments
I agree with you, the current ellipsis often looks out of place, especially in languages like German with long words:
|
This is an issue for me aswell. |
+1 here... ellipsis on just word boundaries and leaving (much) space unused after the ellipsis is not the right way, IMHO, at least not for small texts (e.g. labels in buttons, etc.). Please change this, optionally by adding |
Yeah I have an email in A Text widget and the entire email gets cut out |
You can try this as a workaround. Not sure if it also works with ellipsis. Text(
email,
maxLines: 1,
overflow: TextOverflow.fade,
softWrap: false,
); |
@sir-boformer sadly |
cc @GaryQian |
edit: I found out later that if you set maxlines it overflows appropriately, but it would be nice if it sensed maxlines based on it's parent container |
Some issue I am also facing, if some word is fitting it's replacing the complete word Text(
'Sachin Ramesh Tendulkar ',
softWrap: false,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: new TextStyle(
fontSize: 13.0,
fontFamily: 'Roboto',
color: new Color(0xFF212121),
fontWeight: FontWeight.bold,
),
) If er is not wraping it's removing complete tendulkar word and putting ... final text Sachin ramesh .. |
it seems this is by design |
Current ellipsis is based on soft line break that automatically inserted in paragraph builder. When the word can't fit in to the line, it will get pushed to next line, and that cause it to truncate the whole word if part of it cannot fit. I will come up with a new overflow enum that will truncate the line differently. |
@chunhtai In languages where there are no spaces built in to the language like Japanese, this problem is extremely visible when you mix an alphanumeric sequence with a Japanese string of characters. |
@Moncader We had some discussions on this issue and came up with way to fix it. However, the fix will be on engine side code which will be migrated to skia library in one or two months. We are waiting for that to happen first. |
This comment has been minimized.
This comment has been minimized.
Any progress on this issue? |
@jason-simmons Do you know what is the status of txt skia migration? |
DropdownMenuItem( In my case it is not working |
this workaround make some Arab character broken (الماس => ا ل م ا س). need fix by Flutter team. |
Use this extension
then use it as the following
Working fine with Arabic |
Will this get fixed? |
No, this won't get fixed. |
A viable and just as elegant solution is to simply use |
why not |
@mack-at-pieces thanks for the tip, but unfortunately it wont for for my use case. |
Status update: Fixing this issue requires changes in Skia. We're working with the Skia team to get them an up to date list of issues people would like fixed, and this will be at the top of the list. |
Great to know! Will this be a problem in Impeller as well or is it already working there? |
Great question @feinstein. We still use Skia for text layout, so Impeller won't affect this. |
@roman-petrov that's a good fix. If you make one more modification it also replaces hyphens with non-breaking hyphens: 'UFC 284 - Makhachev vs Volkanovski'
.characters
.replaceAll(Characters(' '), Characters('\u{00A0}'))
.replaceAll(Characters('-'), Characters('\u{2011}'))
.toString() Without the second "UFC 284 -..." Instead of this: "UFC 284 - Makhachev vs V..." |
my current workaround is to replace.
|
Hi @fullflash, if you do it that way just be wary of issues with letter spacing, emojis and hyphens. |
Any status update for this issue? |
/cc @Rusino @jason-simmons @dnfield The Skia team is about to start looking into this. Rough plan is something like:
Also, from discussion:
|
Flutter bugs: flutter/flutter#18761 flutter/flutter#114949 Change-Id: Ic37554a13589bf169283df18050a2e32faf4794b Reviewed-on: https://skia-review.googlesource.com/c/skia/+/668478 Commit-Queue: Julia Lavrova <jlavrova@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
Closing as presumed fixed by https://skia.googlesource.com/skia.git/+log/0d31aa1f49cb8cfd790c44d92a9a023839524865 |
This fix was added in version 3.7.12? Looks like nothing changed |
@MisterLight The changelog for 3.7.12 doesn't mention any changes related to this problem. The fix must be a part of some upcoming release |
This will not be backported to 3.7. I have requested a CP into the 3.10 beta here #125308. |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
Latest update: #18761 (comment)
Internal: b/137284394
Here (#4478) Hixie commented:
"Ok the plan is that rather than truncating individual characters until it fit, we will truncate entire atomic positioned glyph sequences (e.g. whole ligatures or shaped words) until the ellipsis fits. That would have the advantage of being much more performant. It would have the disadvantage of truncating the entire word if the whole line was one ligature (e.g. if your line was the word "Zapfino" in the Zapfino font, and it overflowed at the "o", we would replace the whole thing with a "...", rather than just the "no".)"
Although the above comment talks about ligatures, it seems to me this is being ignored, and whole words are simply being removed.
Now suppose the text
"Laboris nisi ut aliquip ex ea commodo"
gets cut right before word"ex"
. Since the previous word fits, it may cut some letters of that last word to fit the ellipsis, resulting in:"Laboris nisi ut aliqu..."
However, if the horizontal space is a litter smaller, than the letter
"p"
from"aliquip"
won't fit, and it will cut the whole word, resulting in:"Laboris nisi ut ... "
But that's not how overflow works for other platforms, and it makes no sense to remove whole words. The obvious result, if "p" doesn't fit should be, just as before:
"Laboris nisi ut aliqu..."
As things are now, we tend to see a lot of words cut in their last 1 or 2 chars, and a lot of words completely removed, leaving a lot of weird white space. That gets particularly nasty in one line texts like titles.
Please, don't create weird behaviors for things with time-honored traditions like ellipsizing. Stick to what everybody else does. If you want, let the devs choose between both behaviors:
enum TestOverflow {clip, fade, ellipsisWords, ellipsisLetters}
.If Arabic and other eastern languages have problems with that (as per issue 4478), you can even do some autodetection for characters of those languages, by adding the enum
TestOverflow.ellipsisAutodetect
.The text was updated successfully, but these errors were encountered: