Fix visual clipping of singleline TextEdit
This commit is contained in:
parent
c42afd3941
commit
fe2094af14
1 changed files with 7 additions and 4 deletions
|
@ -565,11 +565,14 @@ impl<'t> TextEdit<'t> {
|
||||||
|
|
||||||
let mut galley = layouter(ui, text.as_ref(), wrap_width);
|
let mut galley = layouter(ui, text.as_ref(), wrap_width);
|
||||||
|
|
||||||
|
let desired_width = if multiline {
|
||||||
|
galley.size().x.max(wrap_width) // always show everything in multiline
|
||||||
|
} else {
|
||||||
|
wrap_width // visual clipping with scroll in singleline input. TODO: opt-in/out?
|
||||||
|
};
|
||||||
let desired_height = (desired_height_rows.at_least(1) as f32) * row_height;
|
let desired_height = (desired_height_rows.at_least(1) as f32) * row_height;
|
||||||
let desired_size = vec2(
|
let desired_size = vec2(desired_width, galley.size().y.max(desired_height));
|
||||||
galley.size().x.max(wrap_width),
|
|
||||||
galley.size().y.max(desired_height),
|
|
||||||
);
|
|
||||||
let (auto_id, rect) = ui.allocate_space(desired_size);
|
let (auto_id, rect) = ui.allocate_space(desired_size);
|
||||||
|
|
||||||
let id = id.unwrap_or_else(|| {
|
let id = id.unwrap_or_else(|| {
|
||||||
|
|
Loading…
Reference in a new issue