From c7e206bf6af1835978819d08b2437d107bbb0dc5 Mon Sep 17 00:00:00 2001 From: Brad Culwell Date: Wed, 5 Jun 2024 03:48:40 -0500 Subject: [PATCH] fix: reset to normal mode on yank failure --- src/app.rs | 4 ++-- src/source/torrent_galaxy.rs | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/app.rs b/src/app.rs index d8cf8ab..36922ac 100644 --- a/src/app.rs +++ b/src/app.rs @@ -556,6 +556,7 @@ impl App { match keys.chars().collect::>()[..] { ['y', c] => { let s = self.widgets.results.table.state.selected().unwrap_or(0); + ctx.mode = Mode::Normal; match ctx.results.response.items.get(s).cloned() { Some(item) => { let link = match c { @@ -564,7 +565,7 @@ impl App { 'p' => item.post_link, 'i' => match item.extra.get("imdb").cloned() { Some(imdb) => imdb, - None => return, + None => return ctx.show_error("No imdb ID found for this item."), }, _ => return, }; @@ -579,7 +580,6 @@ impl App { } None => {} } - ctx.mode = Mode::Normal; } _ => ctx.mode = Mode::KeyCombo(keys), } diff --git a/src/source/torrent_galaxy.rs b/src/source/torrent_galaxy.rs index 4cf8f0c..5410740 100644 --- a/src/source/torrent_galaxy.rs +++ b/src/source/torrent_galaxy.rs @@ -465,9 +465,8 @@ impl Source for TorrentGalaxyHtmlSource { false => ItemType::Remake, }; - let torrent_link = attr(e, torrent_sel, "href"); let torrent_link = base_url - .join(&torrent_link) + .join(&attr(e, torrent_sel, "href")) .map(|u| u.to_string()) .unwrap_or_default(); let magnet_link = attr(e, magnet_sel, "href");