Clean up use of Size

This commit is contained in:
Joscha 2022-09-25 19:47:04 +02:00
parent d5c0c94883
commit 147c3eaf92
2 changed files with 1 additions and 6 deletions

View file

@ -15,7 +15,6 @@
#![warn(clippy::use_self)]
// TODO Enable warn(unreachable_pub)?
// TODO Clean up use and manipulation of toss Pos and Size
// TODO Remove unnecessary Debug impls and compare compile times
mod config;

View file

@ -497,11 +497,7 @@ impl Editor {
impl Widget for Editor {
fn size(&self, frame: &mut Frame, max_width: Option<u16>, max_height: Option<u16>) -> Size {
if let Some(placeholder) = &self.hidden {
let mut size = if self.text.text().is_empty() {
Size::new(1, 1)
} else {
placeholder.size(frame, max_width, max_height)
};
let mut size = placeholder.size(frame, max_width, max_height);
// Cursor needs to fit regardless of focus
size.width = size.width.max(1);