2use tokio::task::JoinHandle;
4use crate::diff::{DiffHandle, Hunk};
7 fn new_test(diff_base: &str, doc: &str) -> (DiffHandle, JoinHandle<()>) {
8 DiffHandle::new_with_handle(
9 Rope::from_str(diff_base),
14 async fn into_diff(self, handle: JoinHandle<()>) -> Vec<Hunk> {
15 let hunks = self.hunks;
16 // dropping the channel terminates the task
18 handle.await.unwrap();
19 let hunks = hunks.lock();
25async fn append_line() {
26 let (differ, handle) = DiffHandle::new_test("foo\n", "foo\nbar\n");
27 let line_diffs = differ.into_diff(handle).await;
38async fn prepend_line() {
39 let (differ, handle) = DiffHandle::new_test("foo\n", "bar\nfoo\n");
40 let line_diffs = differ.into_diff(handle).await;
52 let (differ, handle) = DiffHandle::new_test("foo\nbar\n", "foo bar\nbar\n");
53 let line_diffs = differ.into_diff(handle).await;
64async fn delete_line() {
65 let (differ, handle) = DiffHandle::new_test("foo\nfoo bar\nbar\n", "foo\nbar\n");
66 let line_diffs = differ.into_diff(handle).await;
77async fn delete_line_and_modify() {
78 let (differ, handle) = DiffHandle::new_test("foo\nbar\ntest\nfoo", "foo\ntest\nfoo bar");
79 let line_diffs = differ.into_diff(handle).await;
97 let (differ, handle) = DiffHandle::new_test(
98 "use ropey::Rope;\nuse tokio::task::JoinHandle;\n",
99 "use ropey::Rope;\nuse ropey::RopeSlice;\nuse tokio::task::JoinHandle;\n",
101 let line_diffs = differ.into_diff(handle).await;
112async fn update_document() {
113 let (differ, handle) = DiffHandle::new_test("foo\nbar\ntest\nfoo", "foo\nbar\ntest\nfoo");
114 differ.update_document(Rope::from_str("foo\ntest\nfoo bar"), false);
115 let line_diffs = differ.into_diff(handle).await;
132async fn update_base() {
133 let (differ, handle) = DiffHandle::new_test("foo\ntest\nfoo bar", "foo\ntest\nfoo bar");
134 differ.update_diff_base(Rope::from_str("foo\nbar\ntest\nfoo"));
135 let line_diffs = differ.into_diff(handle).await;
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list