diff --git a/Cargo.lock b/Cargo.lock index a0b57af..5222d5f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3697,8 +3697,8 @@ dependencies = [ [[package]] name = "wcgw-kit" -version = "0.1.0" -source = "git+https://github.com/wcgw/wcgw-kit?tag=v0.1.0#88762d4dc388ffb287bda3a94ae5476804c5ea58" +version = "0.1.1" +source = "git+https://github.com/wcgw/wcgw-kit?tag=v0.1.1#3da1bcc32949c7dde4ddecaf9ca8029aa5ef98c6" dependencies = [ "crossterm", "futures-util", @@ -3715,8 +3715,8 @@ dependencies = [ [[package]] name = "wcgw-kit-gfx" -version = "0.1.0" -source = "git+https://github.com/wcgw/wcgw-kit?tag=v0.1.0#88762d4dc388ffb287bda3a94ae5476804c5ea58" +version = "0.1.1" +source = "git+https://github.com/wcgw/wcgw-kit?tag=v0.1.1#3da1bcc32949c7dde4ddecaf9ca8029aa5ef98c6" dependencies = [ "base64 0.22.1", "image", diff --git a/README.md b/README.md index 12fc26b..b6e4aa2 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ accept its terms with `:agree`. The device key is kept in `~/.config/devnull/dev | `s` | Star | | `` | Find a buffer | | `q` | Close the window; the last one quits | +| `bd`, a middle click on its tab | Close the feed or profile (`:bdelete`); opening it again starts it anew | ## Configuration diff --git a/crates/devnull/Cargo.toml b/crates/devnull/Cargo.toml index 48567e2..a801ef2 100644 --- a/crates/devnull/Cargo.toml +++ b/crates/devnull/Cargo.toml @@ -25,10 +25,10 @@ tokio = { version = "1", features = ["rt", "macros", "time", "sync", "fs"] } unicode-segmentation = "1" unicode-width = { version = "0.2", default-features = false } # The shared Neovim look & feel, at its release tag (its D18). -wcgw-kit = { git = "https://github.com/wcgw/wcgw-kit", tag = "v0.1.0" } +wcgw-kit = { git = "https://github.com/wcgw/wcgw-kit", tag = "v0.1.1" } [dev-dependencies] -wcgw-kit = { git = "https://github.com/wcgw/wcgw-kit", tag = "v0.1.0", features = ["testing"] } +wcgw-kit = { git = "https://github.com/wcgw/wcgw-kit", tag = "v0.1.1", features = ["testing"] } insta = "1" serde_json = "1" tempfile = "3" diff --git a/crates/devnull/src/app/mod.rs b/crates/devnull/src/app/mod.rs index cd1396d..86f1852 100644 --- a/crates/devnull/src/app/mod.rs +++ b/crates/devnull/src/app/mod.rs @@ -381,6 +381,12 @@ impl wcgw_kit::App for Dn { self.load(kit, buffer) } + /// `:bd` (`bd`): the feed goes; opening it again starts it anew. + fn deleting(&mut self, _kit: &mut Kit, buffer: BufferId) -> Result { + self.feeds.remove(&buffer); + Ok(Vec::new()) + } + fn keyed(&mut self, kit: &mut Kit) -> Effects { self.load_more(kit) } diff --git a/crates/devnull/src/app/tests.rs b/crates/devnull/src/app/tests.rs index 2cc18bd..e53879a 100644 --- a/crates/devnull/src/app/tests.rs +++ b/crates/devnull/src/app/tests.rs @@ -4574,6 +4574,23 @@ fn animations_in_view_move_on_each_after_its_own_delay() { ); } +#[test] +fn leader_bd_closes_a_feed_and_opening_it_again_starts_it_anew() { + let mut app = with_log(Log::Following, page_of(1, 1, None)); + let opened = press(&mut app, ":e log/latest"); + assert!(!fetches(&opened).is_empty(), "{opened:?}"); + + let _ = press(&mut app, "bd"); + assert!( + statusline(&app).contains("log/following"), + "{}", + statusline(&app) + ); + + let again = press(&mut app, ":e log/latest"); + assert_eq!(fetches(&again), fetches(&opened), "fetched anew"); +} + #[test] fn an_animation_out_of_view_waits_until_it_is_back() { let (mut app, _) = pictured(wcgw_kit::gfx::Graphics::HalfBlocks, with_picture());