Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ accept its terms with `:agree`. The device key is kept in `~/.config/devnull/dev
| `s` | Star |
| `<leader><leader>` | Find a buffer |
| `q` | Close the window; the last one quits |
| `<leader>bd`, a middle click on its tab | Close the feed or profile (`:bdelete`); opening it again starts it anew |

## Configuration

Expand Down
4 changes: 2 additions & 2 deletions crates/devnull/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
6 changes: 6 additions & 0 deletions crates/devnull/src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,12 @@ impl wcgw_kit::App for Dn {
self.load(kit, buffer)
}

/// `:bd` (`<leader>bd`): the feed goes; opening it again starts it anew.
fn deleting(&mut self, _kit: &mut Kit, buffer: BufferId) -> Result<Effects, String> {
self.feeds.remove(&buffer);
Ok(Vec::new())
}

fn keyed(&mut self, kit: &mut Kit) -> Effects {
self.load_more(kit)
}
Expand Down
17 changes: 17 additions & 0 deletions crates/devnull/src/app/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<CR>");
assert!(!fetches(&opened).is_empty(), "{opened:?}");

let _ = press(&mut app, "<Space>bd");
assert!(
statusline(&app).contains("log/following"),
"{}",
statusline(&app)
);

let again = press(&mut app, ":e log/latest<CR>");
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());
Expand Down
Loading