feat(move): pre-populate path

This commit is contained in:
Kristofers Solo 2025-07-09 18:25:09 +03:00
parent 8870478cc6
commit f2650c7090
Signed by: kristoferssolo
GPG Key ID: 8687F2D3EEE6F0ED
2 changed files with 18 additions and 1 deletions

View File

@ -151,6 +151,23 @@ impl<'a> App<'a> {
Ok(())
}
pub fn prepare_move_action(&mut self) {
if let Selected::Current(current_id) = self.selected(true) {
if let Some(torrent) = self
.torrents
.torrents
.iter()
.find(|t| t.id == Some(current_id))
{
if let Some(download_dir) = &torrent.download_dir {
self.input = download_dir.clone();
self.cursor_position = self.input.len();
}
}
}
self.input_mode = true;
}
pub fn select(&mut self) {
if let Selected::Current(current_id) = self.selected(true) {
if self.torrents.selected.contains(&current_id) {

View File

@ -78,7 +78,7 @@ pub async fn update(app: &mut App<'_>, action: Action) -> Result<()> {
Action::ToggleAll => app.torrents.toggle_all().await?,
Action::PauseAll => app.torrents.stop_all().await?,
Action::StartAll => app.torrents.start_all().await?,
Action::Move => app.input_mode = true,
Action::Move => app.prepare_move_action(),
Action::Delete(x) => app.delete(x).await?,
Action::Rename => unimplemented!(),
Action::Select => app.select(),