mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-26 05:37:04 +00:00
Merge branch 'red/rc-chrome-w6' into area/chrome-fw
This commit is contained in:
@@ -228,6 +228,13 @@ pub(crate) fn show(ui: &mut Ui, edit: Edit<'_>) -> Shown {
|
||||
}
|
||||
shown
|
||||
};
|
||||
// A multi-line text taller than its part scrolls inside it: the part is the view, and the text, which the clip
|
||||
// above cuts to the view, the content (S-L186: the text adapter owns the offset).
|
||||
if multiline && galley.is_none() && output.response.rect.height() > rect.height() {
|
||||
let text_rect = egui::Rect::from_min_size(output.galley_pos, output.galley.rect.size());
|
||||
let content = placed.union(output.response.rect).union(text_rect);
|
||||
super::widgets::note_scroll_region(ui.ctx(), rect.intersect(ui.clip_rect()), content);
|
||||
}
|
||||
let focused = output.response.has_focus();
|
||||
let caret = output.cursor_range.map(|range| {
|
||||
let at = output.galley.pos_from_cursor(range.primary);
|
||||
|
||||
@@ -328,12 +328,6 @@ impl<C: Codec + Clone + 'static> Component for TextField<'_, C> {
|
||||
let tall = cx.layout(&TextRun::new(shown).role(self.options.role).wrap(Wrap::Wrap)).size().y;
|
||||
let rows = if line > 0.0 { (tall / line).round() as usize } else { 1 };
|
||||
size.y = size.y.max(height(lines.max(rows)));
|
||||
if self.max_lines.is_some() {
|
||||
eprintln!(
|
||||
"DIAG a_capped_field_grows_to_its_lines_then_scrolls_with_the_caret_in_view: measure line={line} tall={tall} rows={rows} room={:?} size_y={}",
|
||||
cx.room, size.y
|
||||
);
|
||||
}
|
||||
if let Some(most) = self.max_lines {
|
||||
size.y = size.y.min(height(most.max(lines)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user