Only provide WidthDb in [Async]Widget::size

This commit is contained in:
Joscha 2023-02-20 16:59:17 +01:00
parent 417f33cc24
commit 0573fcec77
13 changed files with 91 additions and 83 deletions

View file

@ -480,11 +480,10 @@ impl Editor<'_> {
impl<E> Widget<E> for Editor<'_> {
fn size(
&self,
frame: &mut Frame,
widthdb: &mut WidthDb,
max_width: Option<u16>,
_max_height: Option<u16>,
) -> Result<Size, E> {
let widthdb = frame.widthdb();
let indices = self.indices(widthdb, max_width);
let rows = self.rows(&indices);
Ok(Self::size(widthdb, &rows))
@ -506,11 +505,10 @@ impl<E> Widget<E> for Editor<'_> {
impl<E> AsyncWidget<E> for Editor<'_> {
async fn size(
&self,
frame: &mut Frame,
widthdb: &mut WidthDb,
max_width: Option<u16>,
_max_height: Option<u16>,
) -> Result<Size, E> {
let widthdb = frame.widthdb();
let indices = self.indices(widthdb, max_width);
let rows = self.rows(&indices);
Ok(Self::size(widthdb, &rows))