-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
[TextEdit] Expose all auto-wrap modes. #74813
Conversation
b920ed1
to
3ef8906
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a good feature change, but it does break compatibility. So we need to make sure existing projects won't be broken when opened in 4.1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there are two types of wrapping here, the text server for how to wrap, and TextEdit
when to wrap. For example if adding a new wrap mode at the guidelines rather then the control boundary. Shouldn't we separate these into two properties?
I think that would just affect the width parameter somewhere. So it's not necessary to introduce some special wrapping mode for it, just a flag? |
No it needs to be wrapped, as there could be an option to allow mixed i.e fix column or viewport whichever is smallest, that cannot be conveyed with a width parameter (See VSCode). That was the intended purpose of this property. |
That still sounds like something that is conveyed with a width. So we have two things to handle here:
The control can decide on the bounding box whichever way it wants. It can use its own rect, it can add extra constraints like the guide line, etc. From what I'm seeing, the enum that has been removed in this PR, If the intend for the existing enum is to be extended to support options that you describe, then we can keep it. But then the new enum should still be added and exposed to the But then the existing enum remains with a conflicting option, |
Yes the intent was to prevent breaking compatibility during 4.0, leaving room for the functionality to be extended. I think I like the idea of moving this to a separate API an leaving the current enum with one option, as I don't think |
3ef8906
to
bd71999
Compare
bd71999
to
75e6ec8
Compare
CHECK(text_edit->get_first_visible_line() == (visible_lines / 2) + 6); | ||
CHECK(text_edit->get_v_scroll() == (visible_lines + (visible_lines / 2)) + 1); | ||
CHECK(text_edit->get_last_full_visible_line() == (visible_lines) + 5); | ||
CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do see any logic in these calculations, so I have only adjusted values to match real ones. Default TextEdit
wrapping behavior should not be change, and the only reason this test was passing - set_line_wrapping_mode
was not calling queue_redraw();
and updating wrapping until something else triggered redraw.
Updated to use separate property. |
Thanks! |
Fixes #74256
Fixes #74812