1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 14:20:04 -04:00

Properly respect min_size in TextEdit (#8420)

TextEdit has a min_size field but we completely ignored in the y
direciton. (I probably broke it in #7140).

---------

Co-authored-by: emilk <1148717+emilk@users.noreply.github.com>
This commit is contained in:
Lucas Meurer
2026-09-01 11:39:32 +02:00
committed by GitHub
parent de077b92d3
commit e1507d031d
19 changed files with 38 additions and 37 deletions

View File

@@ -478,7 +478,8 @@ impl TextEdit<'_> {
let desired_width = desired_width
.unwrap_or_else(|| ui.spacing().text_edit_width)
.at_least(min_size.x);
let allocate_width = desired_width.at_most(available_width);
// `min_size` overrides available width
let allocate_width = desired_width.at_most(available_width).at_least(min_size.x);
let font_id_clone = font_id.clone();
let mut default_layouter = move |ui: &Ui, text: &dyn TextBuffer, wrap_width: f32| {
@@ -695,7 +696,7 @@ impl TextEdit<'_> {
let custom_frame = frame.is_some();
let frame = frame.unwrap_or_else(|| Frame::new().inner_margin(margin));
let min_height = min_inner_height + frame.total_margin().sum().y;
let min_height = (min_inner_height + frame.total_margin().sum().y).at_least(min_size.y);
// This wrap mode only affects the hint_text
let wrap_mode = if multiline {

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f8ed8c3114cc34e8415ed5ebed12d54d8790a0b1dfd38cbe8d8d52cef9cf817a
size 11582
oid sha256:43e17cd4cdf81b375b3712cc96e4120344e273bec63661641240682c09b23547
size 11422

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e918acf970083110d9bf2e5fe5fa8570c1d17861117375b3c78ff32988c4e5df
size 12600
oid sha256:9f4353b4d275ccf1c1c8b46c41891d9c0f41f5fe819639089c9641bc0d86b250
size 12439

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:dac827ce7a3c829acb789d6b87006ec58929ce72efbf552b595266b220ca5960
size 15524
oid sha256:c462de8c5337429bf410be6a541873ed960adcf73c11c78794adccda31469178
size 15383

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9b7961331cf4842ea955e1e62b3ab74de0e589441d0830c45d0285080ea67d03
size 15169
oid sha256:109ad8a176217732e119c18f744b777f7d9c3e5d4b1182452531c6c4e85e4720
size 15018

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0885a39324b015b92761d09fc1a6694d11d4b1fa9dfb23e05273479ed82a7b09
size 13624
oid sha256:6cde52b614311b45da3b9344187e8cec9f1a20414b6ffa679c1c0853e7457352
size 13434

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6572c4c44e12f49152cc2dfcae39140ffe69a0a1172d6aca540f10d5ba9b609e
size 14633
oid sha256:2be092619d8a8b48cadb8993c6f361af667bfa4d51474b5065a4cb6312046718
size 14470

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:76be7b08da637ecbf898efd8322615d5e2f1cb1757665e5486db86ccb7fb3438
size 9462
oid sha256:65161f878e9f6609f8b8a8898ad6c11ef3a730682389b6ea5e3fb6534277cb34
size 9247

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bceb25ddc48567a79389d8333eeffa3db4f083d47488a05772602d6145faf2ea
size 11830
oid sha256:e31ef6a2ab778ceb81d8cc7c53902156848675a70328a739c4b6a5f52ea6372d
size 11639

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:30e17cfb5c21e3fd6f850e022f301787bd04d1e6453e3bd30ff695de1f61b8c1
size 12524
oid sha256:cabad94d00cf0705c5def54bf4c792da41e6724722ce18cf796c2e33c659b6fc
size 12326

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a05d5b941f2681f3466f0caa19dd6a71099fc897ba5eb7ac760e6ed6ba92d4be
size 13971
oid sha256:53c8c191c282607cadf2c170e7064e97763bb726c107f974c9117285df274e44
size 13814

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:568e1c2c0d28bcf5507d97562bedf12d32e99f78f75b3ac70f937115ea97a3ed
size 14141
oid sha256:5770c40fe3b237d3922a9bd0e652a677275aa87f7e51455d5f2709c626bbacab
size 13984

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3e4b3d8ad1d40ca0d4c8f6a547cc470239b65ffd7de59fdb413fcf39934d9bd9
size 11078
oid sha256:372a31a0232a5428c4749176dc7c7fa1cd6b7c8b825be21260d78b891866fe9e
size 10939

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:01afe50f7bc1177c7beaff73d10b63fbf6ff73ad621e76d9da05ecc3f5c362c7
size 8614
oid sha256:5cb44e23f6200e82ff136a0cd46c5fdba2965f70ae1c32429ece1a4c9c90330f
size 8446

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5b4e19e088cacfc0524aad0e4cba32f701e57f3d9fd27bfc2b285949315c07a9
size 10577
oid sha256:b5e6bd242e16be23b2a445935408e1c71cec562b0ba2d33b192df89864c5b9f8
size 10402

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5be608caad5e27606dada8f99a2e95bced62b865d8274463b76224299c8abc7e
size 22257
oid sha256:63f68ae19a7a83f3646515e439603ddef55800de2d9665993bb4bedd8251901c
size 22093

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0e6eb347e0622502e2fab2e06aee376d1b41338d504c136b9dfeae6de0465ddf
size 9234
oid sha256:8924fbf75e91e108bd5f8bde679ace433c867d0b0a1a564f59497abb9e189c33
size 9060

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:51949a5a32c81c03dcb93d7ea02780abce5acde7a627681562470ee4f3f932fb
size 10993
oid sha256:aa2b96051e29422955d214c821500a1a83444da079e1854e648f84437a19c629
size 10825

View File

@@ -337,7 +337,7 @@ impl<'a> VisualTests<'a> {
modifiers: Default::default(),
});
});
self.add_node("focussed", |node| {
self.add_node("focused", |node| {
node.focus();
});
self.add_disabled();