-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Apply TextWrapMode::Extend
in TextEdit
#4838
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: Emil Ernerfeldt <[email protected]>
let wrap_width = if wrap_mode == TextWrapMode::Extend { | ||
f32::INFINITY | ||
} else { | ||
wrap_width | ||
}; |
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 logic is now only run for the default_layouter
, while custom layouters gets the previous wrap_width
which ignores wrap_mode
.
f32::INFINITY, | ||
hint_text_font_id, | ||
) | ||
hint_text.into_galley(ui, Some(wrap_mode), f32::INFINITY, hint_text_font_id) |
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 single-line text-edits should always use Extend
, otherwise they are not single-line
@@ -481,7 +481,15 @@ impl<'t> TextEdit<'t> { | |||
const MIN_WIDTH: f32 = 24.0; // Never make a [`TextEdit`] more narrow than this. | |||
let available_width = (ui.available_width() - margin.sum().x).at_least(MIN_WIDTH); | |||
let desired_width = desired_width.unwrap_or_else(|| ui.spacing().text_edit_width); | |||
let wrap_width = if ui.layout().horizontal_justify() { | |||
|
|||
let wrap_mode = ui.style().wrap_mode.unwrap_or(if multiline { |
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.
Should we really use TextWrapMode::Truncate
if set? I don't think that will work very well
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.
TextWrapMode::Truncate
I made some changes, but I'm not sure if the changes will work everywhere.
I haven't reviewed the TextWrapMode::Truncate
issue.
I'm not sure how TextWrapMode::Truncate
is supposed to work with singleline()
and multiline()
, and what it's intended to do.
How about handling the TextWrapMode::Truncate
issue in a new commit?
You can drop this and create a new one.
Apply
TextWrapMode::Extend
inTextEdit
I'm not sure if this is the correct approach.