bin: Use new inline viewport interface

This commit is contained in:
Erik Kundt
2024-09-13 15:38:08 +02:00
parent 098adf470e
commit 3b4f2951e0
3 changed files with 10 additions and 5 deletions
+2 -1
View File
@@ -5,6 +5,7 @@ use std::str::FromStr;
use anyhow::Result;
use ratatui::Viewport;
use termion::event::Key;
use ratatui::layout::Constraint;
@@ -293,7 +294,7 @@ impl App {
.into()
});
tui::rm(channel, state, window).await
tui::rm(state, window, Viewport::Inline(20), channel).await
}
}
+2 -1
View File
@@ -6,6 +6,7 @@ use std::str::FromStr;
use anyhow::{bail, Result};
use ratatui::Viewport;
use termion::event::Key;
use ratatui::layout::Constraint;
@@ -369,7 +370,7 @@ impl App {
.into()
});
tui::rm(channel, state, window).await
tui::rm(state, window, Viewport::Inline(20), channel).await
}
}
+6 -3
View File
@@ -7,6 +7,7 @@ use std::str::FromStr;
use anyhow::Result;
use ratatui::Viewport;
use termion::event::Key;
use radicle_tui as tui;
@@ -22,8 +23,8 @@ use tui::ui::rm::widget::window::{
Page, PageProps, Shortcuts, ShortcutsProps, Window, WindowProps,
};
use tui::ui::rm::widget::{ToWidget, Widget};
use tui::ui::{span, BufferedValue};
use tui::ui::Column;
use tui::ui::{span, BufferedValue};
use tui::{BoxedAny, Channel, Exit, PageStack};
@@ -58,11 +59,13 @@ impl App {
}
pub async fn run(&self) -> Result<Option<Selection>> {
let viewport = Viewport::Inline(20);
if self.im {
let channel = Channel::default();
let state = imui::App::try_from(&self.context)?;
tui::im(channel, state).await
tui::im(state, viewport, channel).await
} else {
let channel = Channel::default();
let tx = channel.tx.clone();
@@ -78,7 +81,7 @@ impl App {
.into()
});
tui::rm(channel, state, window).await
tui::rm(state, window, viewport, channel).await
}
}
}