editor: Fix soft wrap premature wrapping with certain fonts#45206
editor: Fix soft wrap premature wrapping with certain fonts#45206Veykril merged 5 commits intozed-industries:mainfrom
Conversation
|
Looks like this causes a test failure cc @MrSubidubi, seems to be a test added by you, in case you have context here |
|
The test very much checks what the error says, so if this fails, it is very likely that we actually have minimal scrolling with soft wrap enabled, which we should never have. Test is supposed to catch just that (we regressed there too many times). So this might change more in the editor than it perhaps should, some calculation there might be different due to this change and would result in scrolling with soft wrap |
Head branch was pushed to by a user without write access
|
Thanks @/MrSubidubi. Tests should pass now 🙈 |
|
Can you give a bit more context on this as to why this fixes the issue now? |
|
Sorry, I realized that I shouldn't have updated I thought I'd make it consistent with Now, I've updated the editor prepaint to use actual rendered char width instead of raw glyph advance width coming from |
| let em_width = window.text_system().em_width(font_id, font_size).unwrap(); | ||
| let em_advance = window.text_system().em_advance(font_id, font_size).unwrap(); | ||
| let run = TextRun { | ||
| len: 1, | ||
| font: style.text.font(), | ||
| ..Default::default() | ||
| }; | ||
| let em_rendered_width = window | ||
| .text_system() | ||
| .layout_line("m", font_size, &[run], None) | ||
| .width; |
There was a problem hiding this comment.
Feels like we should give this its own method like is done with em_width and em_advance for consistency
There was a problem hiding this comment.
Also, why does em_width not suffice here?
There was a problem hiding this comment.
Hey, apologies for the delay. Yeah i tried using em_width but it doesn't work and i'm not really sure why tbh. So i just made it match with the line wrapper calculation.
a488c38 to
92d5901
Compare
8c06eed to
a5f6176
Compare

Closes #45107
Release Notes: